diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 839147dbe62f8..0489c7335d7ea 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -42,15 +42,12 @@ * don't use this class directly if you need to get metadata, use \OC\Files\Filesystem::getFileInfo instead */ class Cache extends CacheJail { - /** - * @var \OCA\Files_Sharing\SharedStorage - */ + /** @var \OCA\Files_Sharing\SharedStorage */ private $storage; - - /** - * @var ICacheEntry - */ + /** @var ICacheEntry */ private $sourceRootInfo; + /** @var IUserManager */ + private $userManager; private $rootUnchanged = true; @@ -58,13 +55,10 @@ class Cache extends CacheJail { private $numericId; - /** - * @param \OCA\Files_Sharing\SharedStorage $storage - * @param ICacheEntry $sourceRootInfo - */ - public function __construct($storage, ICacheEntry $sourceRootInfo) { + public function __construct(SharedStorage $storage, ICacheEntry $sourceRootInfo, IUserManager $userManager) { $this->storage = $storage; $this->sourceRootInfo = $sourceRootInfo; + $this->userManager = $userManager; $this->numericId = $sourceRootInfo->getStorageId(); parent::__construct( @@ -168,7 +162,7 @@ protected function formatCacheEntry($entry, $path = null) { private function getOwnerDisplayName() { if (!$this->ownerDisplayName) { $uid = $this->storage->getOwner(''); - $user = \OC::$server->get(IUserManager::class)->get($uid); + $user = $this->userManager->get($uid); if ($user) { $this->ownerDisplayName = $user->getDisplayName(); } else { diff --git a/apps/files_sharing/lib/SharedStorage.php b/apps/files_sharing/lib/SharedStorage.php index 901634c1e9ff4..b9f9cca4fc796 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -43,6 +43,7 @@ use OCP\Files\NotFoundException; use OCP\Files\Storage\IDisableEncryptionStorage; use OCP\Files\Storage\IStorage; +use OCP\IUserManager; use OCP\Lock\ILockingProvider; /** @@ -384,7 +385,11 @@ public function getCache($path = '', $storage = null) { return new FailedCache(); } - $this->cache = new \OCA\Files_Sharing\Cache($storage, $sourceRoot, $this->superShare); + $this->cache = new \OCA\Fwiles_Sharing\Cache( + $storage, + $sourceRoot, + \OC::$server->get(IUserManager::class) + ); return $this->cache; }