cache the displayname of the share owner

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2016-11-18 11:21:45 +01:00
parent 02bfd91553
commit dbd7f6dea6
No known key found for this signature in database
GPG Key ID: 425003AC385454C5
1 changed files with 10 additions and 1 deletions

View File

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