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
No related branches found
No related tags found
No related merge requests found
...@@ -27,8 +27,10 @@ ...@@ -27,8 +27,10 @@
class OC_FileProxy_Quota extends OC_FileProxy{ class OC_FileProxy_Quota extends OC_FileProxy{
private function getFreeSpace(){ 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_Preferences::getValue(OC_User::getUser(),'files','quota',0);
$totalSpace=OC_Helper::computerFileSize($totalSpace);
if($totalSpace==0){ if($totalSpace==0){
return 0; return 0;
} }
......
...@@ -6,10 +6,13 @@ require_once('../../lib/base.php'); ...@@ -6,10 +6,13 @@ require_once('../../lib/base.php');
OC_JSON::checkAdminUser(); OC_JSON::checkAdminUser();
$username = $_POST["username"]; $username = $_POST["username"];
//make sure the quota is in the expected format
$quota= OC_Helper::computerFileSize($_POST["quota"]); $quota= OC_Helper::computerFileSize($_POST["quota"]);
$quota=OC_Helper::humanFileSize($quota);
// Return Success story // Return Success story
OC_Preferences::setValue($username,'files','quota',$quota); 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(); ...@@ -18,7 +18,7 @@ $users = array();
$groups = array(); $groups = array();
foreach( OC_User::getUsers() as $i ){ 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 ){ 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