diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-15 22:24:57 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-09-15 22:24:57 +0200 |
commit | af0069bf032d2045abd18abf2e133835fc360481 (patch) | |
tree | 7d60994c051a0794b93d9207c26330c4f99c5e84 | |
parent | 5acb3c4c0d570b2bf7b209d61e5e7849f4f3a363 (diff) | |
download | nextcloud-server-af0069bf032d2045abd18abf2e133835fc360481.tar.gz nextcloud-server-af0069bf032d2045abd18abf2e133835fc360481.zip |
adding getRootFolder() to server container and hooking up the new files api
-rw-r--r-- | lib/public/iservercontainer.php | 8 | ||||
-rw-r--r-- | lib/server.php | 20 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 144c1a5b3b9..d88330698dc 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -54,4 +54,12 @@ interface IServerContainer { * @return \OCP\IPreview */ function getPreviewManager(); + + /** + * Returns the root folder of ownCloud's data directory + * + * @return \OCP\Files\Folder + */ + function getRootFolder(); + } diff --git a/lib/server.php b/lib/server.php index d85996612e9..9e87bd3190d 100644 --- a/lib/server.php +++ b/lib/server.php @@ -4,6 +4,8 @@ namespace OC; use OC\AppFramework\Http\Request; use OC\AppFramework\Utility\SimpleContainer; +use OC\Files\Node\Root; +use OC\Files\View; use OCP\IServerContainer; /** @@ -47,6 +49,14 @@ class Server extends SimpleContainer implements IServerContainer { $this->registerService('PreviewManager', function($c){ return new PreviewManager(); }); + $this->registerService('RootFolder', function($c){ + // TODO: get user and user manager from container as well + $user = \OC_User::getUser(); + $user = \OC_User::getManager()->get($user); + $manager = \OC\Files\Filesystem::getMountManager(); + $view = new View(); + return new Root($manager, $view, $user); + }); } /** @@ -77,4 +87,14 @@ class Server extends SimpleContainer implements IServerContainer { { return $this->query('PreviewManager'); } + + /** + * Returns the root folder of ownCloud's data directory + * + * @return \OCP\Files\Folder + */ + function getRootFolder() + { + return $this->query('RootFolder'); + } } |