diff options
author | Robin Appelman <robin@icewind.nl> | 2021-10-15 16:02:57 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2021-10-26 14:44:13 +0200 |
commit | 06b59b500214af35ad7076bb0077fc2231f90c0f (patch) | |
tree | be4ce7a37f21ca83efba24ae33711b4e14c5c541 | |
parent | df013e2d537592b4695cc1f3ffa5a4d60169afea (diff) | |
download | nextcloud-server-06b59b500214af35ad7076bb0077fc2231f90c0f.tar.gz nextcloud-server-06b59b500214af35ad7076bb0077fc2231f90c0f.zip |
more reliable hasUpdated for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files_external/lib/Lib/Storage/AmazonS3.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php index 230ea10121f..e1383b8404c 100644 --- a/apps/files_external/lib/Lib/Storage/AmazonS3.php +++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php @@ -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; + } + } } |