Skip to content
Snippets Groups Projects
Commit 835d6a9b authored by Robin Appelman's avatar Robin Appelman
Browse files

save quota in human readable format (42 MB), should prevent some of the overflow related problems

parent a9e94a34
Branches
No related tags found
No related merge requests found
......@@ -27,8 +27,10 @@
class OC_FileProxy_Quota extends OC_FileProxy{
private function getFreeSpace(){
$usedSpace=OC_Filesystem::filesize('');
$rootInfo=OC_FileCache::get('');
$usedSpace=$rootInfo['size'];
$totalSpace=OC_Preferences::getValue(OC_User::getUser(),'files','quota',0);
$totalSpace=OC_Helper::computerFileSize($totalSpace);
if($totalSpace==0){
return 0;
}
......
......@@ -6,10 +6,13 @@ require_once('../../lib/base.php');
OC_JSON::checkAdminUser();
$username = $_POST["username"];
//make sure the quota is in the expected format
$quota= OC_Helper::computerFileSize($_POST["quota"]);
$quota=OC_Helper::humanFileSize($quota);
// Return Success story
OC_Preferences::setValue($username,'files','quota',$quota);
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>OC_Helper::humanFileSize($quota))));
OC_JSON::success(array("data" => array( "username" => $username ,'quota'=>$quota)));
?>
......@@ -18,7 +18,7 @@ $users = array();
$groups = array();
foreach( OC_User::getUsers() as $i ){
$users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Helper::humanFileSize(OC_Preferences::getValue($i,'files','quota',0)));
$users[] = array( "name" => $i, "groups" => join( ", ", OC_Group::getUserGroups( $i ) ),'quota'=>OC_Preferences::getValue($i,'files','quota',0));
}
foreach( OC_Group::getGroups() as $i ){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment