]> source.dussan.org Git - nextcloud-server.git/commitdiff
more reliable hasUpdated for s3
authorRobin Appelman <robin@icewind.nl>
Fri, 15 Oct 2021 14:02:57 +0000 (16:02 +0200)
committerRobin Appelman <robin@icewind.nl>
Tue, 26 Oct 2021 12:44:13 +0000 (14:44 +0200)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index 230ea10121f12340168dc38b0f159390fdd25ec4..e1383b8404c449c92c1e433dc85d835e9a496c3f 100644 (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;
+               }
+       }
 }