From 9fdeed8cc063874bd46598e3134d9f90b9cbd7aa Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 8 Sep 2020 14:38:36 +0200 Subject: [PATCH] Run stat less often for objectstorages When we want to get the permissions we now do stat at least 5 times for each entry. Which is a bit much. Especially since the permssions are all just in the database already. Signed-off-by: Roeland Jago Douma --- lib/private/Files/ObjectStore/ObjectStoreStorage.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index faa0342935..950840301b 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -227,6 +227,16 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { } } + public function getPermissions($path) { + $stat = $this->stat($path); + + if (is_array($stat) && isset($stat['permissions'])) { + return $stat['permissions']; + } + + return parent::getPermissions($path); + } + /** * Override this method if you need a different unique resource identifier for your object storage implementation. * The default implementations just appends the fileId to 'urn:oid:'. Make sure the URN is unique over all users.