save quota in human readable format (42 MB), should prevent some of the overflow related problems
This commit is contained in:
parent
a9e94a34c9
commit
835d6a9b6e
3 changed files with 8 additions and 3 deletions
|
@ -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 ){
|
||||
|
|
Loading…
Reference in a new issue