diff options
author | Robin Appelman <robin@icewind.nl> | 2021-10-15 16:02:57 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2021-10-22 12:34:30 +0000 |
commit | 4108655a46bc367add1b675de9c7937eb2bc4d2e (patch) | |
tree | 2d7658524197cbf622244f25269299f02160f81e /apps | |
parent | 7983ded102bf94a8a54d70093c46a6eb30443456 (diff) | |
download | nextcloud-server-4108655a46bc367add1b675de9c7937eb2bc4d2e.tar.gz nextcloud-server-4108655a46bc367add1b675de9c7937eb2bc4d2e.zip |
more reliable hasUpdated for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-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 9c7d6a554b3..527a87aeb9a 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; + } + } } |