summaryrefslogtreecommitdiffstats
path: root/core/Application.php
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-04-04 23:15:00 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-04-13 14:06:29 +0200
commit781784553889601d02553931aed8ff1fde95640b (patch)
tree21dd1b23c192d23be1ab1f468ff77165b7591172 /core/Application.php
parentcd95fce105fe5f0e71b1bcac7685464f936b9749 (diff)
downloadnextcloud-server-781784553889601d02553931aed8ff1fde95640b.tar.gz
nextcloud-server-781784553889601d02553931aed8ff1fde95640b.zip
Add a metadata service to store file metadata
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'core/Application.php')
-rw-r--r--core/Application.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/Application.php b/core/Application.php
index 545588ab208..34932cab183 100644
--- a/core/Application.php
+++ b/core/Application.php
@@ -48,12 +48,17 @@ use OC\DB\MissingColumnInformation;
use OC\DB\MissingIndexInformation;
use OC\DB\MissingPrimaryKeyInformation;
use OC\DB\SchemaWrapper;
+use OC\Metadata\FileEventListener;
use OCP\AppFramework\App;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\Files\Events\Node\NodeDeletedEvent;
+use OCP\Files\Events\Node\NodeWrittenEvent;
+use OCP\Files\Events\NodeRemovedFromCache;
use OCP\IDBConnection;
use OCP\User\Events\BeforeUserDeletedEvent;
use OCP\User\Events\UserDeletedEvent;
use OCP\Util;
+use OCP\IConfig;
use Symfony\Component\EventDispatcher\GenericEvent;
/**
@@ -301,5 +306,15 @@ class Application extends App {
$eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, UserDeletedFilesCleanupListener::class);
$eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedFilesCleanupListener::class);
$eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedWebAuthnCleanupListener::class);
+
+ // Metadata
+ /** @var IConfig $config */
+ $config = $container->get(IConfig::class);
+ if ($config->getSystemValueBool('enable_file_metadata', true)) {
+ $eventDispatcher = \OC::$server->get(IEventDispatcher::class);
+ $eventDispatcher->addServiceListener(NodeDeletedEvent::class, FileEventListener::class);
+ $eventDispatcher->addServiceListener(NodeRemovedFromCache::class, FileEventListener::class);
+ $eventDispatcher->addServiceListener(NodeWrittenEvent::class, FileEventListener::class);
+ }
}
}