diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-11-29 21:45:06 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2021-06-17 10:22:37 +0200 |
commit | 2690481cbad009b74292fdfbd028fc8b5b01a394 (patch) | |
tree | f992db57c42ec3ce60ca6ecfc5d0bae52e4a0ae5 /apps | |
parent | 095418493ef909d25808d278ee099fb34070c7fb (diff) | |
download | nextcloud-server-2690481cbad009b74292fdfbd028fc8b5b01a394.tar.gz nextcloud-server-2690481cbad009b74292fdfbd028fc8b5b01a394.zip |
Use DI for files_sharing Cache
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 17 | ||||
-rw-r--r-- | apps/files_sharing/lib/SharedStorage.php | 7 |
2 files changed, 13 insertions, 11 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index ab8adda725e..8729426221b 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -46,15 +46,12 @@ use OCP\IUserManager; * 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; @@ -64,11 +61,11 @@ class Cache extends CacheJail { /** * @param \OCA\Files_Sharing\SharedStorage $storage - * @param ICacheEntry $sourceRootInfo */ - public function __construct($storage, ICacheEntry $sourceRootInfo) { + public function __construct($storage, ICacheEntry $sourceRootInfo, IUserManager $userManager) { $this->storage = $storage; $this->sourceRootInfo = $sourceRootInfo; + $this->userManager = $userManager; $this->numericId = $sourceRootInfo->getStorageId(); parent::__construct( @@ -176,7 +173,7 @@ class Cache extends CacheJail { 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 662c5ad3651..f4a525ce871 100644 --- a/apps/files_sharing/lib/SharedStorage.php +++ b/apps/files_sharing/lib/SharedStorage.php @@ -43,6 +43,7 @@ use OCP\Files\Cache\ICacheEntry; use OCP\Files\NotFoundException; use OCP\Files\Storage\IDisableEncryptionStorage; use OCP\Files\Storage\IStorage; +use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Share\IShare; @@ -385,7 +386,11 @@ class SharedStorage extends \OC\Files\Storage\Wrapper\Jail implements ISharedSto return new FailedCache(); } - $this->cache = new \OCA\Files_Sharing\Cache($storage, $sourceRoot, $this->superShare); + $this->cache = new \OCA\Files_Sharing\Cache( + $storage, + $sourceRoot, + \OC::$server->get(IUserManager::class) + ); return $this->cache; } |