summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files_trashbin/lib/Events/MoveToTrashEvent.php1
-rw-r--r--apps/files_trashbin/lib/Storage.php11
-rw-r--r--apps/files_trashbin/tests/StorageTest.php4
3 files changed, 9 insertions, 7 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);
diff --git a/apps/files_trashbin/tests/StorageTest.php b/apps/files_trashbin/tests/StorageTest.php
index 15b47385d45..b4b995c3ae5 100644
--- a/apps/files_trashbin/tests/StorageTest.php
+++ b/apps/files_trashbin/tests/StorageTest.php
@@ -41,6 +41,7 @@ use OCA\Files_Trashbin\Storage;
use OCA\Files_Trashbin\Trash\ITrashManager;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Utility\ITimeFactory;
+use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Cache\ICache;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
@@ -50,7 +51,6 @@ use OCP\ILogger;
use OCP\IUserManager;
use OCP\Lock\ILockingProvider;
use OCP\Share\IShare;
-use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Test\Traits\MountProviderTrait;
class TemporaryNoCross extends Temporary {
@@ -607,7 +607,7 @@ class StorageTest extends \Test\TestCase {
$userManager->expects($this->any())
->method('userExists')->willReturn($userExists);
$logger = $this->getMockBuilder(ILogger::class)->getMock();
- $eventDispatcher = $this->createMock(EventDispatcherInterface::class);
+ $eventDispatcher = $this->createMock(IEventDispatcher::class);
$rootFolder = $this->createMock(IRootFolder::class);
$userFolder = $this->createMock(Folder::class);
$node = $this->getMockBuilder(Node::class)->disableOriginalConstructor()->getMock();