diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2020-04-22 15:21:15 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-05-28 12:35:45 +0200 |
commit | 6aa6ab3e02c1ab50992c824b85ecc1a45988379c (patch) | |
tree | d09f950d2905d24497cea60fe3042dd2f62f89a1 /lib/private/Server.php | |
parent | 1d469fc06e6a6755dbb5543b33fecb9ff2b57340 (diff) | |
download | nextcloud-server-6aa6ab3e02c1ab50992c824b85ecc1a45988379c.tar.gz nextcloud-server-6aa6ab3e02c1ab50992c824b85ecc1a45988379c.zip |
Add lazy events for the Node API
Right now if you want to get events via the Node API you have to have a
real instance of the Root. Which in turns sets up the whole FS.
We should make sure this is done lazy. Else enabling the preview
generator for example makes you setup the whole FS on each and every
authenticated call.
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r-- | lib/private/Server.php | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 9c3c6391c34..ba628d1269f 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -373,14 +373,21 @@ class Server extends ServerContainer implements IServerContainer { $this->getLogger(), $this->getUserManager() ); - $connector = new HookConnector($root, $view, $c->getEventDispatcher()); - $connector->viewToNode(); $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig()); $previewConnector->connectWatcher(); return $root; }); + $this->registerService(HookConnector::class, function (Server $c) { + return new HookConnector( + $c->query(IRootFolder::class), + new View(), + $c->query(\OC\EventDispatcher\SymfonyAdapter::class), + $c->query(IEventDispatcher::class) + ); + }); + $this->registerDeprecatedAlias('SystemTagObjectMapper', ISystemTagObjectMapper::class); $this->registerService(IRootFolder::class, function (Server $c) { @@ -1359,6 +1366,12 @@ class Server extends ServerContainer implements IServerContainer { $this->connectDispatcher(); } + public function boot() { + /** @var HookConnector $hookConnector */ + $hookConnector = $this->query(HookConnector::class); + $hookConnector->viewToNode(); + } + /** * @return \OCP\Calendar\IManager */ |