aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/lib/Lib/Storage/AmazonS3.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2021-10-15 16:02:57 +0200
committerRobin Appelman <robin@icewind.nl>2021-10-15 16:02:57 +0200
commit4bd08af2adf6742751aba089d28f6cb486e69e13 (patch)
treee10b4d64d54c41639d73a72067a60c2b4d6b1830 /apps/files_external/lib/Lib/Storage/AmazonS3.php
parent34637697e1310728d138aa4386f890dfc4ffd288 (diff)
downloadnextcloud-server-4bd08af2adf6742751aba089d28f6cb486e69e13.tar.gz
nextcloud-server-4bd08af2adf6742751aba089d28f6cb486e69e13.zip
more reliable hasUpdated for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/lib/Lib/Storage/AmazonS3.php')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php13
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;
+ }
+ }
}