]> source.dussan.org Git - nextcloud-server.git/commitdiff
cache the displayname of the share owner 2196/head
authorRobin Appelman <robin@icewind.nl>
Fri, 18 Nov 2016 10:21:45 +0000 (11:21 +0100)
committerRobin Appelman <robin@icewind.nl>
Fri, 18 Nov 2016 10:26:00 +0000 (11:26 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
apps/files_sharing/lib/Cache.php

index 21f3ff622f9256bff1706ac0158d94fc02ba7aa3..038be1c3fea57352c4e11cfaae05cab376938862 100644 (file)
@@ -59,6 +59,8 @@ class Cache extends CacheJail {
 
        private $rootUnchanged = true;
 
+       private $ownerDisplayName;
+
        /**
         * @param \OCA\Files_Sharing\SharedStorage $storage
         * @param IStorage $sourceStorage
@@ -120,13 +122,20 @@ class Cache extends CacheJail {
                        $entry['permissions'] = $sharePermissions;
                }
                $entry['uid_owner'] = $this->storage->getOwner($path);
-               $entry['displayname_owner'] = \OC_User::getDisplayName($entry['uid_owner']);
+               $entry['displayname_owner'] = $this->getOwnerDisplayName();
                if ($path === '') {
                        $entry['is_share_mount_point'] = true;
                }
                return $entry;
        }
 
+       private function getOwnerDisplayName() {
+               if (!$this->ownerDisplayName) {
+                       $this->ownerDisplayName = \OC_User::getDisplayName($this->storage->getOwner(''));
+               }
+               return $this->ownerDisplayName;
+       }
+
        /**
         * remove all entries for files that are stored on the storage from the cache
         */