use OCP\Files\Storage\IStorage;
use OCP\ILogger;
use OCP\IUserManager;
+use Psr\Log\LoggerInterface;
class Storage extends Wrapper {
- /** @var IMountPoint */
- private $mountPoint;
-
- /** @var IUserManager */
- private $userManager;
-
- /** @var ILogger */
- private $logger;
-
- /** @var IEventDispatcher */
- private $eventDispatcher;
-
- /** @var IRootFolder */
- private $rootFolder;
-
- /** @var ITrashManager */
- private $trashManager;
-
- private $trashEnabled = true;
+ private string $mountPoint;
+ private IUserManager$userManager;
+ private LoggerInterface $logger;
+ private IEventDispatcher $eventDispatcher;
+ private IRootFolder $rootFolder;
+ private ITrashManager $trashManager;
+ private bool $trashEnabled = true;
/**
* Storage constructor.
*
* @param array $parameters
- * @param ITrashManager $trashManager
+ * @param ITrashManager|null $trashManager
* @param IUserManager|null $userManager
- * @param ILogger|null $logger
+ * @param LoggerInterface|null $logger
* @param IEventDispatcher|null $eventDispatcher
* @param IRootFolder|null $rootFolder
*/
$parameters,
ITrashManager $trashManager = null,
IUserManager $userManager = null,
- ILogger $logger = null,
+ LoggerInterface $logger = null,
IEventDispatcher $eventDispatcher = null,
IRootFolder $rootFolder = null
) {
}
/**
- * 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->get(IEventDispatcher::class),
- \OC::$server->getLazyRootFolder()
- );
- }, 1);
+ $trashManager = \OC::$server->get(ITrashManager::class);
+ $userManager = \OC::$server->get(IUserManager::class);
+ $logger = \OC::$server->get(LoggerInterface::class);
+ $eventDispatcher = \OC::$server->get(IEventDispatcher::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() {
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Share\IShare;
+use Psr\Log\LoggerInterface;
use Test\Traits\MountProviderTrait;
class TemporaryNoCross extends Temporary {
->disableOriginalConstructor()->getMock();
$userManager->expects($this->any())
->method('userExists')->willReturn($userExists);
- $logger = $this->getMockBuilder(ILogger::class)->getMock();
+ $logger = $this->getMockBuilder(LoggerInterface::class)->getMock();
$eventDispatcher = $this->createMock(IEventDispatcher::class);
$rootFolder = $this->createMock(IRootFolder::class);
$userFolder = $this->createMock(Folder::class);