adding getRootFolder() to server container and hooking up the new files api

This commit is contained in:
Thomas Müller 2013-09-15 22:24:57 +02:00
parent 5acb3c4c0d
commit af0069bf03
2 changed files with 28 additions and 0 deletions

View File

@ -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();
}

View File

@ -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');
}
}