more reliable hasUpdated for s3

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2021-10-15 16:02:57 +02:00
parent df013e2d53
commit 06b59b5002
No known key found for this signature in database
GPG key ID: 42B69D8A64526EFB

View file

@ -724,4 +724,17 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
return $this->versioningEnabled;
}
public function hasUpdated($path, $time) {
// for files we can get the proper mtime
if ($path !== '' && $object = $this->headObject($path)) {
$stat = $this->objectToMetaData($object);
return $stat['mtime'] > $time;
} else {
// for directories, the only real option we have is to do a prefix listing and iterate over all objects
// however, since this is just as expensive as just re-scanning the directory, we can simply return true
// and have the scanner figure out if anything has actually changed
return true;
}
}
}