summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2023-08-15 16:51:35 +0200
committerRobin Appelman <robin@icewind.nl>2023-09-07 16:24:59 +0200
commit4c604bf53106e76609e7fd368e12fcfdd46e6f42 (patch)
treef09112349c4a4db728bbe5ec0f7c25593e24c74e /apps/files_trashbin/lib
parent5ebceaa54c04ff238174c2fcd2edbe6174399e91 (diff)
downloadnextcloud-server-4c604bf53106e76609e7fd368e12fcfdd46e6f42.tar.gz
nextcloud-server-4c604bf53106e76609e7fd368e12fcfdd46e6f42.zip
only gather dependencies for trashbin wrapper once
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Storage.php32
1 files changed, 20 insertions, 12 deletions
diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php
index f08d8d25a55..09b0dcf0a1a 100644
--- a/apps/files_trashbin/lib/Storage.php
+++ b/apps/files_trashbin/lib/Storage.php
@@ -66,7 +66,7 @@ class Storage extends Wrapper {
* Storage constructor.
*
* @param array $parameters
- * @param ITrashManager $trashManager
+ * @param ITrashManager|null $trashManager
* @param IUserManager|null $userManager
* @param ILogger|null $logger
* @param EventDispatcherInterface|null $eventDispatcher
@@ -208,19 +208,27 @@ class Storage extends Wrapper {
}
/**
- * Setup the storate wrapper callback
+ * Setup the storage wrapper callback
*/
public static function setupStorage() {
- \OC\Files\Filesystem::addStorageWrapper('oc_trashbin', function ($mountPoint, $storage) {
- return new \OCA\Files_Trashbin\Storage(
- ['storage' => $storage, 'mountPoint' => $mountPoint],
- \OC::$server->query(ITrashManager::class),
- \OC::$server->getUserManager(),
- \OC::$server->getLogger(),
- \OC::$server->getEventDispatcher(),
- \OC::$server->getLazyRootFolder()
- );
- }, 1);
+ $trashManager = \OC::$server->get(ITrashManager::class);
+ $userManager = \OC::$server->get(IUserManager::class);
+ $logger = \OC::$server->get(ILogger::class);
+ $eventDispatcher = \OC::$server->get(EventDispatcherInterface::class);
+ $rootFolder = \OC::$server->get(IRootFolder::class);
+ Filesystem::addStorageWrapper(
+ 'oc_trashbin',
+ function (string $mountPoint, IStorage $storage) use ($trashManager, $userManager, $logger, $eventDispatcher, $rootFolder) {
+ return new Storage(
+ ['storage' => $storage, 'mountPoint' => $mountPoint],
+ $trashManager,
+ $userManager,
+ $logger,
+ $eventDispatcher,
+ $rootFolder,
+ );
+ },
+ 1);
}
public function getMountPoint() {