Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
only gather dependencies for trashbin wrapper once
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Sep 7, 2023
commit 4c604bf53106e76609e7fd368e12fcfdd46e6f42
32 changes: 20 additions & 12 deletions apps/files_trashbin/lib/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -208,19 +208,27 @@ private function doDelete($path, $method) {
}

/**
* 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() {
Expand Down