From 23fb497ff59a90813cba24ca1c82be979cf95046 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 13 Nov 2020 17:04:36 +0100 Subject: [PATCH 1/3] extend cache events - adds cache remove event - expose storage id in event - emit events during cache move Signed-off-by: Robin Appelman --- lib/composer/composer/autoload_classmap.php | 1 + lib/composer/composer/autoload_static.php | 1 + .../Files/Cache/AbstractCacheEvent.php | 12 ++++++- lib/private/Files/Cache/Cache.php | 18 ++++++++-- lib/private/Files/Cache/CacheEntry.php | 2 +- lib/public/Files/Cache/CacheRemoveEvent.php | 34 +++++++++++++++++++ lib/public/Files/Cache/ICacheEvent.php | 6 ++++ 7 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 lib/public/Files/Cache/CacheRemoveEvent.php diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index 4f04d90b22b..aa9e91053d1 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -219,6 +219,7 @@ return array( 'OCP\\Files' => $baseDir . '/lib/public/Files.php', 'OCP\\Files\\AlreadyExistsException' => $baseDir . '/lib/public/Files/AlreadyExistsException.php', 'OCP\\Files\\Cache\\CacheInsertEvent' => $baseDir . '/lib/public/Files/Cache/CacheInsertEvent.php', + 'OCP\\Files\\Cache\\CacheRemoveEvent' => $baseDir . '/lib/public/Files/Cache/CacheRemoveEvent.php', 'OCP\\Files\\Cache\\CacheUpdateEvent' => $baseDir . '/lib/public/Files/Cache/CacheUpdateEvent.php', 'OCP\\Files\\Cache\\ICache' => $baseDir . '/lib/public/Files/Cache/ICache.php', 'OCP\\Files\\Cache\\ICacheEntry' => $baseDir . '/lib/public/Files/Cache/ICacheEntry.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 27972767576..21ec6d257bb 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -248,6 +248,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Files' => __DIR__ . '/../../..' . '/lib/public/Files.php', 'OCP\\Files\\AlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/Files/AlreadyExistsException.php', 'OCP\\Files\\Cache\\CacheInsertEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheInsertEvent.php', + 'OCP\\Files\\Cache\\CacheRemoveEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheRemoveEvent.php', 'OCP\\Files\\Cache\\CacheUpdateEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheUpdateEvent.php', 'OCP\\Files\\Cache\\ICache' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/ICache.php', 'OCP\\Files\\Cache\\ICacheEntry' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/ICacheEntry.php', diff --git a/lib/private/Files/Cache/AbstractCacheEvent.php b/lib/private/Files/Cache/AbstractCacheEvent.php index a4029476fa5..bb7ade386e0 100644 --- a/lib/private/Files/Cache/AbstractCacheEvent.php +++ b/lib/private/Files/Cache/AbstractCacheEvent.php @@ -36,6 +36,7 @@ class AbstractCacheEvent extends Event implements ICacheEvent { protected $storage; protected $path; protected $fileId; + protected $storageId; /** * @param IStorage $storage @@ -43,10 +44,11 @@ class AbstractCacheEvent extends Event implements ICacheEvent { * @param int $fileId * @since 16.0.0 */ - public function __construct(IStorage $storage, string $path, int $fileId) { + public function __construct(IStorage $storage, string $path, int $fileId, int $storageId) { $this->storage = $storage; $this->path = $path; $this->fileId = $fileId; + $this->storageId = $storageId; } /** @@ -80,4 +82,12 @@ class AbstractCacheEvent extends Event implements ICacheEvent { public function getFileId(): int { return $this->fileId; } + + /** + * @return int + * @since 21.0.0 + */ + public function getStorageId(): int { + return $this->storageId; + } } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 1d3b4da3bce..bf8d35411fb 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -42,6 +42,7 @@ use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Cache\CacheInsertEvent; +use OCP\Files\Cache\CacheRemoveEvent; use OCP\Files\Cache\CacheUpdateEvent; use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; @@ -284,7 +285,8 @@ class Cache implements ICache { $data['name'] = basename($file); [$values, $extensionValues] = $this->normalizeData($data); - $values['storage'] = $this->getNumericStorageId(); + $storageId = $this->getNumericStorageId(); + $values['storage'] = $storageId; try { $builder = $this->connection->getQueryBuilder(); @@ -308,7 +310,7 @@ class Cache implements ICache { $query->execute(); } - $this->eventDispatcher->dispatch(CacheInsertEvent::class, new CacheInsertEvent($this->storage, $file, $fileId)); + $this->eventDispatcher->dispatch(CacheInsertEvent::class, new CacheInsertEvent($this->storage, $file, $fileId, $storageId)); return $fileId; } } catch (UniqueConstraintViolationException $e) { @@ -399,7 +401,7 @@ class Cache implements ICache { $path = $this->getPathById($id); // path can still be null if the file doesn't exist if ($path !== null) { - $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $path, $id)); + $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $path, $id, $this->getNumericStorageId())); } } @@ -536,6 +538,8 @@ class Cache implements ICache { if ($entry->getMimeType() == FileInfo::MIMETYPE_FOLDER) { $this->removeChildren($entry); } + + $this->eventDispatcher->dispatch(CacheRemoveEvent::class, new CacheRemoveEvent($this->storage, $entry->getPath(), $entry->getId(), $this->getNumericStorageId())); } } @@ -677,9 +681,17 @@ class Cache implements ICache { $query->execute(); $this->connection->commit(); + + if ($sourceCache->getNumericStorageId() !== $this->getNumericStorageId()) { + $this->eventDispatcher->dispatch(CacheRemoveEvent::class, new CacheRemoveEvent($this->storage, $sourcePath, $sourceId, $sourceCache->getNumericStorageId())); + $this->eventDispatcher->dispatch(CacheInsertEvent::class, new CacheInsertEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId())); + } else { + $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId())); + } } else { $this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath); } + } /** diff --git a/lib/private/Files/Cache/CacheEntry.php b/lib/private/Files/Cache/CacheEntry.php index a0ba9020909..5f31ecfbec3 100644 --- a/lib/private/Files/Cache/CacheEntry.php +++ b/lib/private/Files/Cache/CacheEntry.php @@ -67,7 +67,7 @@ class CacheEntry implements ICacheEntry { public function getPath() { - return $this->data['path']; + return (string)$this->data['path']; } diff --git a/lib/public/Files/Cache/CacheRemoveEvent.php b/lib/public/Files/Cache/CacheRemoveEvent.php new file mode 100644 index 00000000000..3b1e536f471 --- /dev/null +++ b/lib/public/Files/Cache/CacheRemoveEvent.php @@ -0,0 +1,34 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCP\Files\Cache; + +use OC\Files\Cache\AbstractCacheEvent; + +/** + * Event for when an existing entry in the cache gets removed + * + * @since 21.0.0 + */ +class CacheRemoveEvent extends AbstractCacheEvent { +} diff --git a/lib/public/Files/Cache/ICacheEvent.php b/lib/public/Files/Cache/ICacheEvent.php index 634666f594a..56f6f46df1c 100644 --- a/lib/public/Files/Cache/ICacheEvent.php +++ b/lib/public/Files/Cache/ICacheEvent.php @@ -56,4 +56,10 @@ interface ICacheEvent { * @since 16.0.0 */ public function getFileId(): int; + + /** + * @return int + * @since 21.0.0 + */ + public function getStorageId(): int; } From 88f35d52d2baf6421725ce5f2a40331afe13f1de Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 26 Nov 2020 15:39:46 +0100 Subject: [PATCH 2/3] rename cache event to follow new naming standards Signed-off-by: Robin Appelman --- lib/composer/composer/autoload_classmap.php | 4 ++- lib/composer/composer/autoload_static.php | 4 ++- lib/private/Files/Cache/Cache.php | 30 +++++++++++----- .../Files/Cache/CacheEntryInsertedEvent.php | 35 +++++++++++++++++++ ...veEvent.php => CacheEntryRemovedEvent.php} | 2 +- .../Files/Cache/CacheEntryUpdatedEvent.php | 35 +++++++++++++++++++ lib/public/Files/Cache/CacheInsertEvent.php | 5 ++- lib/public/Files/Cache/CacheUpdateEvent.php | 5 ++- 8 files changed, 103 insertions(+), 17 deletions(-) create mode 100644 lib/public/Files/Cache/CacheEntryInsertedEvent.php rename lib/public/Files/Cache/{CacheRemoveEvent.php => CacheEntryRemovedEvent.php} (92%) create mode 100644 lib/public/Files/Cache/CacheEntryUpdatedEvent.php diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index aa9e91053d1..3e589199e1c 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -218,8 +218,10 @@ return array( 'OCP\\Federation\\ICloudIdManager' => $baseDir . '/lib/public/Federation/ICloudIdManager.php', 'OCP\\Files' => $baseDir . '/lib/public/Files.php', 'OCP\\Files\\AlreadyExistsException' => $baseDir . '/lib/public/Files/AlreadyExistsException.php', + 'OCP\\Files\\Cache\\CacheEntryInsertedEvent' => $baseDir . '/lib/public/Files/Cache/CacheEntryInsertedEvent.php', + 'OCP\\Files\\Cache\\CacheEntryRemovedEvent' => $baseDir . '/lib/public/Files/Cache/CacheEntryRemovedEvent.php', + 'OCP\\Files\\Cache\\CacheEntryUpdatedEvent' => $baseDir . '/lib/public/Files/Cache/CacheEntryUpdatedEvent.php', 'OCP\\Files\\Cache\\CacheInsertEvent' => $baseDir . '/lib/public/Files/Cache/CacheInsertEvent.php', - 'OCP\\Files\\Cache\\CacheRemoveEvent' => $baseDir . '/lib/public/Files/Cache/CacheRemoveEvent.php', 'OCP\\Files\\Cache\\CacheUpdateEvent' => $baseDir . '/lib/public/Files/Cache/CacheUpdateEvent.php', 'OCP\\Files\\Cache\\ICache' => $baseDir . '/lib/public/Files/Cache/ICache.php', 'OCP\\Files\\Cache\\ICacheEntry' => $baseDir . '/lib/public/Files/Cache/ICacheEntry.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 21ec6d257bb..c9ca76614b8 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -247,8 +247,10 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Federation\\ICloudIdManager' => __DIR__ . '/../../..' . '/lib/public/Federation/ICloudIdManager.php', 'OCP\\Files' => __DIR__ . '/../../..' . '/lib/public/Files.php', 'OCP\\Files\\AlreadyExistsException' => __DIR__ . '/../../..' . '/lib/public/Files/AlreadyExistsException.php', + 'OCP\\Files\\Cache\\CacheEntryInsertedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheEntryInsertedEvent.php', + 'OCP\\Files\\Cache\\CacheEntryRemovedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheEntryRemovedEvent.php', + 'OCP\\Files\\Cache\\CacheEntryUpdatedEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheEntryUpdatedEvent.php', 'OCP\\Files\\Cache\\CacheInsertEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheInsertEvent.php', - 'OCP\\Files\\Cache\\CacheRemoveEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheRemoveEvent.php', 'OCP\\Files\\Cache\\CacheUpdateEvent' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/CacheUpdateEvent.php', 'OCP\\Files\\Cache\\ICache' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/ICache.php', 'OCP\\Files\\Cache\\ICacheEntry' => __DIR__ . '/../../..' . '/lib/public/Files/Cache/ICacheEntry.php', diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index bf8d35411fb..83b81d284c3 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -41,8 +41,11 @@ namespace OC\Files\Cache; use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; use OCP\DB\QueryBuilder\IQueryBuilder; +use OCP\EventDispatcher\IEventDispatcher; +use OCP\Files\Cache\CacheEntryInsertedEvent; +use OCP\Files\Cache\CacheEntryUpdatedEvent; use OCP\Files\Cache\CacheInsertEvent; -use OCP\Files\Cache\CacheRemoveEvent; +use OCP\Files\Cache\CacheEntryRemovedEvent; use OCP\Files\Cache\CacheUpdateEvent; use OCP\Files\Cache\ICache; use OCP\Files\Cache\ICacheEntry; @@ -92,6 +95,9 @@ class Cache implements ICache { */ protected $connection; + /** + * @var IEventDispatcher + */ protected $eventDispatcher; /** @var QuerySearchHelper */ @@ -110,7 +116,7 @@ class Cache implements ICache { $this->storageCache = new Storage($storage); $this->mimetypeLoader = \OC::$server->getMimeTypeLoader(); $this->connection = \OC::$server->getDatabaseConnection(); - $this->eventDispatcher = \OC::$server->getEventDispatcher(); + $this->eventDispatcher = \OC::$server->get(IEventDispatcher::class); $this->querySearchHelper = new QuerySearchHelper($this->mimetypeLoader); } @@ -310,7 +316,9 @@ class Cache implements ICache { $query->execute(); } - $this->eventDispatcher->dispatch(CacheInsertEvent::class, new CacheInsertEvent($this->storage, $file, $fileId, $storageId)); + $event = new CacheEntryInsertedEvent($this->storage, $file, $fileId, $storageId); + $this->eventDispatcher->dispatch(CacheInsertEvent::class, $event); + $this->eventDispatcher->dispatchTyped($event); return $fileId; } } catch (UniqueConstraintViolationException $e) { @@ -401,7 +409,9 @@ class Cache implements ICache { $path = $this->getPathById($id); // path can still be null if the file doesn't exist if ($path !== null) { - $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $path, $id, $this->getNumericStorageId())); + $event = new CacheEntryUpdatedEvent($this->storage, $path, $id, $this->getNumericStorageId()); + $this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event); + $this->eventDispatcher->dispatchTyped($event); } } @@ -539,7 +549,7 @@ class Cache implements ICache { $this->removeChildren($entry); } - $this->eventDispatcher->dispatch(CacheRemoveEvent::class, new CacheRemoveEvent($this->storage, $entry->getPath(), $entry->getId(), $this->getNumericStorageId())); + $this->eventDispatcher->dispatch(CacheEntryRemovedEvent::class, new CacheEntryRemovedEvent($this->storage, $entry->getPath(), $entry->getId(), $this->getNumericStorageId())); } } @@ -683,10 +693,14 @@ class Cache implements ICache { $this->connection->commit(); if ($sourceCache->getNumericStorageId() !== $this->getNumericStorageId()) { - $this->eventDispatcher->dispatch(CacheRemoveEvent::class, new CacheRemoveEvent($this->storage, $sourcePath, $sourceId, $sourceCache->getNumericStorageId())); - $this->eventDispatcher->dispatch(CacheInsertEvent::class, new CacheInsertEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId())); + $this->eventDispatcher->dispatchTyped(new CacheEntryRemovedEvent($this->storage, $sourcePath, $sourceId, $sourceCache->getNumericStorageId())); + $event = new CacheEntryInsertedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId()); + $this->eventDispatcher->dispatch(CacheInsertEvent::class, $event); + $this->eventDispatcher->dispatchTyped($event); } else { - $this->eventDispatcher->dispatch(CacheUpdateEvent::class, new CacheUpdateEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId())); + $event = new CacheEntryUpdatedEvent($this->storage, $targetPath, $sourceId, $this->getNumericStorageId()); + $this->eventDispatcher->dispatch(CacheUpdateEvent::class, $event); + $this->eventDispatcher->dispatchTyped($event); } } else { $this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath); diff --git a/lib/public/Files/Cache/CacheEntryInsertedEvent.php b/lib/public/Files/Cache/CacheEntryInsertedEvent.php new file mode 100644 index 00000000000..936cf8c6021 --- /dev/null +++ b/lib/public/Files/Cache/CacheEntryInsertedEvent.php @@ -0,0 +1,35 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCP\Files\Cache; + + +use OC\Files\Cache\AbstractCacheEvent; + +/** + * Event for when an existing entry in the cache gets inserted + * + * @since 21.0.0 + */ +class CacheEntryInsertedEvent extends AbstractCacheEvent implements ICacheEvent { +} diff --git a/lib/public/Files/Cache/CacheRemoveEvent.php b/lib/public/Files/Cache/CacheEntryRemovedEvent.php similarity index 92% rename from lib/public/Files/Cache/CacheRemoveEvent.php rename to lib/public/Files/Cache/CacheEntryRemovedEvent.php index 3b1e536f471..e257e1cfaa2 100644 --- a/lib/public/Files/Cache/CacheRemoveEvent.php +++ b/lib/public/Files/Cache/CacheEntryRemovedEvent.php @@ -30,5 +30,5 @@ use OC\Files\Cache\AbstractCacheEvent; * * @since 21.0.0 */ -class CacheRemoveEvent extends AbstractCacheEvent { +class CacheEntryRemovedEvent extends AbstractCacheEvent implements ICacheEvent { } diff --git a/lib/public/Files/Cache/CacheEntryUpdatedEvent.php b/lib/public/Files/Cache/CacheEntryUpdatedEvent.php new file mode 100644 index 00000000000..252a306404d --- /dev/null +++ b/lib/public/Files/Cache/CacheEntryUpdatedEvent.php @@ -0,0 +1,35 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCP\Files\Cache; + + +use OC\Files\Cache\AbstractCacheEvent; + +/** + * Event for when an existing entry in the cache gets updated + * + * @since 21.0.0 + */ +class CacheEntryUpdatedEvent extends AbstractCacheEvent implements ICacheEvent { +} diff --git a/lib/public/Files/Cache/CacheInsertEvent.php b/lib/public/Files/Cache/CacheInsertEvent.php index 84fc1a2e928..08ab15f9a2d 100644 --- a/lib/public/Files/Cache/CacheInsertEvent.php +++ b/lib/public/Files/Cache/CacheInsertEvent.php @@ -26,12 +26,11 @@ declare(strict_types=1); namespace OCP\Files\Cache; -use OC\Files\Cache\AbstractCacheEvent; - /** * Event for when a new entry gets added to the cache * * @since 16.0.0 + * @deprecated 21.0.0 use CacheEntryInsertedEvent instead */ -class CacheInsertEvent extends AbstractCacheEvent { +class CacheInsertEvent extends CacheEntryInsertedEvent { } diff --git a/lib/public/Files/Cache/CacheUpdateEvent.php b/lib/public/Files/Cache/CacheUpdateEvent.php index f20056d2666..54397045398 100644 --- a/lib/public/Files/Cache/CacheUpdateEvent.php +++ b/lib/public/Files/Cache/CacheUpdateEvent.php @@ -26,12 +26,11 @@ declare(strict_types=1); namespace OCP\Files\Cache; -use OC\Files\Cache\AbstractCacheEvent; - /** * Event for when an existing entry in the cache gets updated * * @since 16.0.0 + * @deprecated 21.0.0 use CacheEntryUpdatedEvent instead */ -class CacheUpdateEvent extends AbstractCacheEvent { +class CacheUpdateEvent extends CacheEntryUpdatedEvent { } From aef1cdba03319e1958f284f56acf183051470ad3 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 2 Dec 2020 16:15:02 +0100 Subject: [PATCH 3/3] code style and dispatchTyped Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Cache.php | 3 +-- lib/public/Files/Cache/CacheEntryInsertedEvent.php | 1 - lib/public/Files/Cache/CacheEntryUpdatedEvent.php | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 83b81d284c3..be44d461933 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -549,7 +549,7 @@ class Cache implements ICache { $this->removeChildren($entry); } - $this->eventDispatcher->dispatch(CacheEntryRemovedEvent::class, new CacheEntryRemovedEvent($this->storage, $entry->getPath(), $entry->getId(), $this->getNumericStorageId())); + $this->eventDispatcher->dispatchTyped(new CacheEntryRemovedEvent($this->storage, $entry->getPath(), $entry->getId(), $this->getNumericStorageId())); } } @@ -705,7 +705,6 @@ class Cache implements ICache { } else { $this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath); } - } /** diff --git a/lib/public/Files/Cache/CacheEntryInsertedEvent.php b/lib/public/Files/Cache/CacheEntryInsertedEvent.php index 936cf8c6021..3b7e6ef8b49 100644 --- a/lib/public/Files/Cache/CacheEntryInsertedEvent.php +++ b/lib/public/Files/Cache/CacheEntryInsertedEvent.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCP\Files\Cache; - use OC\Files\Cache\AbstractCacheEvent; /** diff --git a/lib/public/Files/Cache/CacheEntryUpdatedEvent.php b/lib/public/Files/Cache/CacheEntryUpdatedEvent.php index 252a306404d..4966f8fdb4a 100644 --- a/lib/public/Files/Cache/CacheEntryUpdatedEvent.php +++ b/lib/public/Files/Cache/CacheEntryUpdatedEvent.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace OCP\Files\Cache; - use OC\Files\Cache\AbstractCacheEvent; /**