]> source.dussan.org Git - nextcloud-server.git/commitdiff
Reuse cache for directory mtime/size if filesystem changes can be ignored 22172/head
authorJulius Härtl <jus@bitgrid.net>
Tue, 7 Jul 2020 08:22:22 +0000 (10:22 +0200)
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>
Mon, 10 Aug 2020 13:32:45 +0000 (13:32 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/files_external/lib/Lib/Storage/AmazonS3.php

index 3c8b6c29d5aefa9473707d9fd0b0a7ef7376c074..c9862d7fb34a9d878ced7a56ceb0beec3fac43a0 100644 (file)
@@ -44,6 +44,7 @@ use Aws\S3\S3Client;
 use Icewind\Streams\CallbackWrapper;
 use Icewind\Streams\IteratorDirectory;
 use OC\Cache\CappedMemoryCache;
+use OC\Files\Cache\CacheEntry;
 use OC\Files\ObjectStore\S3ConnectionTrait;
 use OC\Files\ObjectStore\S3ObjectTrait;
 use OCP\Constants;
@@ -373,6 +374,11 @@ class AmazonS3 extends \OC\Files\Storage\Common {
                                //folders don't really exist
                                $stat['size'] = -1; //unknown
                                $stat['mtime'] = time();
+                               $cacheEntry = $this->getCache()->get($path);
+                               if ($cacheEntry instanceof CacheEntry && $this->getMountOption('filesystem_check_changes', 1) !== 1) {
+                                       $stat['size'] = $cacheEntry->getSize();
+                                       $stat['mtime'] = $cacheEntry->getMTime();
+                               }
                        } else {
                                $stat['size'] = $this->getContentLength($path);
                                $stat['mtime'] = strtotime($this->getLastModified($path));