Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2020-07-07 11:22:22 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2020-08-10 16:32:29 +0300
commit112e2f67475ec61625490cb7fd8c5f992df215f5 (patch)
tree51b00c7c224261e259d0ff06b0e57f230a2acc8e /apps
parent97a5b19a1174dd5fd6cef097dc28c27790b483af (diff)
Reuse cache for directory mtime/size if filesystem changes can be ignored
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/lib/Lib/Storage/AmazonS3.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/apps/files_external/lib/Lib/Storage/AmazonS3.php b/apps/files_external/lib/Lib/Storage/AmazonS3.php
index 641a26b20ee..4a49f70dd58 100644
--- a/apps/files_external/lib/Lib/Storage/AmazonS3.php
+++ b/apps/files_external/lib/Lib/Storage/AmazonS3.php
@@ -45,6 +45,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;
@@ -374,6 +375,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));