From af0069bf032d2045abd18abf2e133835fc360481 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Sun, 15 Sep 2013 22:24:57 +0200 Subject: [PATCH] adding getRootFolder() to server container and hooking up the new files api --- lib/public/iservercontainer.php | 8 ++++++++ lib/server.php | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 144c1a5b3b..d88330698d 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 d85996612e..9e87bd3190 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'); + } }