add convinience function to get filesystem view for app storage

This commit is contained in:
Robin Appelman 2012-02-08 21:01:09 +01:00
parent c4a6b99814
commit 24748ee10f
1 changed files with 18 additions and 0 deletions

View File

@ -403,4 +403,22 @@ class OC_App{
include OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/update.php';
}
}
/**
* @param string appid
* @return OC_FilesystemView
*/
public static function getStorage($appid){
if(OC_App::isEnabled($appid)){//sanity check
if(OC_User::isLoggedIn()){
return new OC_FilesystemView('/'.OC_User::getUser().'/'.$appid);
}else{
OC_Log::write('core','Can\'t get app storage, app, user not logged in',OC_Log::ERROR);
return false;
}
}else{
OC_Log::write('core','Can\'t get app storage, app '.$appid.' not enabled',OC_Log::ERROR);
false;
}
}
}