Merge pull request #4898 from owncloud/server_folder_methods
Server folder methods
This commit is contained in:
commit
843f15f348
|
@ -62,6 +62,20 @@ interface IServerContainer {
|
|||
*/
|
||||
function getRootFolder();
|
||||
|
||||
/**
|
||||
* Returns a view to ownCloud's files folder
|
||||
*
|
||||
* @return \OCP\Files\Folder
|
||||
*/
|
||||
function getUserFolder();
|
||||
|
||||
/**
|
||||
* Returns an app-specific view in ownClouds data directory
|
||||
*
|
||||
* @return \OCP\Files\Folder
|
||||
*/
|
||||
function getAppFolder();
|
||||
|
||||
/**
|
||||
* Returns the user session
|
||||
*
|
||||
|
|
|
@ -148,6 +148,42 @@ class Server extends SimpleContainer implements IServerContainer {
|
|||
return $this->query('RootFolder');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a view to ownCloud's files folder
|
||||
*
|
||||
* @return \OCP\Files\Folder
|
||||
*/
|
||||
function getUserFolder() {
|
||||
|
||||
$dir = '/files';
|
||||
$root = $this->getRootFolder();
|
||||
$folder = null;
|
||||
if(!$root->nodeExists($dir)) {
|
||||
$folder = $root->newFolder($dir);
|
||||
} else {
|
||||
$folder = $root->get($dir);
|
||||
}
|
||||
return $folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an app-specific view in ownClouds data directory
|
||||
*
|
||||
* @return \OCP\Files\Folder
|
||||
*/
|
||||
function getAppFolder() {
|
||||
|
||||
$dir = '/' . \OC_App::getCurrentApp();
|
||||
$root = $this->getRootFolder();
|
||||
$folder = null;
|
||||
if(!$root->nodeExists($dir)) {
|
||||
$folder = $root->newFolder($dir);
|
||||
} else {
|
||||
$folder = $root->get($dir);
|
||||
}
|
||||
return $folder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \OC\User\Manager
|
||||
*/
|
||||
|
@ -175,6 +211,7 @@ class Server extends SimpleContainer implements IServerContainer {
|
|||
function getConfig() {
|
||||
return $this->query('AllConfig');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an ICache instance
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue