diff options
author | Joas Schilling <coding@schilljs.com> | 2023-07-07 11:27:29 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-19 17:37:33 +0200 |
commit | a6bf93501deb1d2d01535e586388aeb5e6ee93f5 (patch) | |
tree | 153b63c2eb19803d955c68022f19f4a9b5bf082a /apps/files_trashbin/lib | |
parent | 489b4807dbc52e69590846ff76d0d4d5b4ab2968 (diff) | |
download | nextcloud-server-a6bf93501deb1d2d01535e586388aeb5e6ee93f5.tar.gz nextcloud-server-a6bf93501deb1d2d01535e586388aeb5e6ee93f5.zip |
fix(files_trashbin): Migrate to IEventDispatcher and emit as typed event
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r-- | apps/files_trashbin/lib/Events/MoveToTrashEvent.php | 1 | ||||
-rw-r--r-- | apps/files_trashbin/lib/Storage.php | 11 |
2 files changed, 7 insertions, 5 deletions
diff --git a/apps/files_trashbin/lib/Events/MoveToTrashEvent.php b/apps/files_trashbin/lib/Events/MoveToTrashEvent.php index 3dce70f96bd..c07d7822e3a 100644 --- a/apps/files_trashbin/lib/Events/MoveToTrashEvent.php +++ b/apps/files_trashbin/lib/Events/MoveToTrashEvent.php @@ -33,6 +33,7 @@ use OCP\Files\Node; * Event to allow other apps to disable the trash bin for specific files * * @package OCA\Files_Trashbin\Events + * @since 28.0.0 Dispatched as a typed event */ class MoveToTrashEvent extends Event { diff --git a/apps/files_trashbin/lib/Storage.php b/apps/files_trashbin/lib/Storage.php index f08d8d25a55..68d0951b694 100644 --- a/apps/files_trashbin/lib/Storage.php +++ b/apps/files_trashbin/lib/Storage.php @@ -33,13 +33,13 @@ use OC\Files\Storage\Wrapper\Wrapper; use OCA\Files_Trashbin\Events\MoveToTrashEvent; use OCA\Files_Trashbin\Trash\ITrashManager; use OCP\Encryption\Exceptions\GenericEncryptionException; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\IRootFolder; use OCP\Files\Mount\IMountPoint; use OCP\Files\Node; use OCP\Files\Storage\IStorage; use OCP\ILogger; use OCP\IUserManager; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; class Storage extends Wrapper { /** @var IMountPoint */ @@ -51,7 +51,7 @@ class Storage extends Wrapper { /** @var ILogger */ private $logger; - /** @var EventDispatcherInterface */ + /** @var IEventDispatcher */ private $eventDispatcher; /** @var IRootFolder */ @@ -69,7 +69,7 @@ class Storage extends Wrapper { * @param ITrashManager $trashManager * @param IUserManager|null $userManager * @param ILogger|null $logger - * @param EventDispatcherInterface|null $eventDispatcher + * @param IEventDispatcher|null $eventDispatcher * @param IRootFolder|null $rootFolder */ public function __construct( @@ -77,7 +77,7 @@ class Storage extends Wrapper { ITrashManager $trashManager = null, IUserManager $userManager = null, ILogger $logger = null, - EventDispatcherInterface $eventDispatcher = null, + IEventDispatcher $eventDispatcher = null, IRootFolder $rootFolder = null ) { $this->mountPoint = $parameters['mountPoint']; @@ -153,6 +153,7 @@ class Storage extends Wrapper { foreach ($nodes as $node) { $event = $this->createMoveToTrashEvent($node); + $this->eventDispatcher->dispatchTyped($event); $this->eventDispatcher->dispatch('OCA\Files_Trashbin::moveToTrash', $event); if ($event->shouldMoveToTrashBin() === false) { return false; @@ -217,7 +218,7 @@ class Storage extends Wrapper { \OC::$server->query(ITrashManager::class), \OC::$server->getUserManager(), \OC::$server->getLogger(), - \OC::$server->getEventDispatcher(), + \OC::$server->get(IEventDispatcher::class), \OC::$server->getLazyRootFolder() ); }, 1); |