summaryrefslogtreecommitdiffstats
path: root/lib/private/Server.php
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-03-11 14:00:36 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-04-13 11:23:02 +0200
commit5cd8382d390a76baa713d0a9e84d53256654902b (patch)
treeb6ac25b6726f5ce489bd191dde7588b76ac5405e /lib/private/Server.php
parent739542816a052e141a02977b88b54ba0613cc211 (diff)
downloadnextcloud-server-5cd8382d390a76baa713d0a9e84d53256654902b.tar.gz
nextcloud-server-5cd8382d390a76baa713d0a9e84d53256654902b.zip
Add lazyRootFolder
Diffstat (limited to 'lib/private/Server.php')
-rw-r--r--lib/private/Server.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 2ce895c6f72..b29f4f9000c 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -48,6 +48,7 @@ use OC\Diagnostics\QueryLogger;
use OC\Files\Config\UserMountCache;
use OC\Files\Config\UserMountCacheListener;
use OC\Files\Node\HookConnector;
+use OC\Files\Node\LazyRoot;
use OC\Files\Node\Root;
use OC\Files\View;
use OC\Http\Client\ClientService;
@@ -172,6 +173,11 @@ class Server extends ServerContainer implements IServerContainer {
$connector->viewToNode();
return $root;
});
+ $this->registerService('LazyRootFolder', function(Server $c) {
+ return new LazyRoot(function() use ($c) {
+ return $c->getRootFolder();
+ });
+ });
$this->registerService('UserManager', function (Server $c) {
$config = $c->getConfig();
return new \OC\User\Manager($config);
@@ -621,7 +627,7 @@ class Server extends ServerContainer implements IServerContainer {
$c->getL10N('core'),
$factory,
$c->getUserManager(),
- $c->getRootFolder()
+ $c->getLazyRootFolder()
);
return $manager;
@@ -728,6 +734,17 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
+ * Returns the root folder of ownCloud's data directory
+ * This is the lazy variant so this gets only initialized once it
+ * is actually used.
+ *
+ * @return \OCP\Files\IRootFolder
+ */
+ public function getLazyRootFolder() {
+ return $this->query('LazyRootFolder');
+ }
+
+ /**
* Returns a view to ownCloud's files folder
*
* @param string $userId user ID