Skip to content

Commit

Permalink
Dev: Always show storage in megabytes with one decimal and correct ra…
Browse files Browse the repository at this point in the history
…dix point
  • Loading branch information
olleharstedt committed Sep 22, 2017
1 parent 9aa0183 commit e94f989
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application/controllers/admin/globalsettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function getStorageData()
$data = array();

$uploaddir = Yii::app()->getConfig("uploaddir");
$decimals = 0;
$decimals = 1;

$data['totalStorage'] = humanFilesize(folderSize($uploaddir), $decimals);
$data['templateSize'] = humanFilesize(folderSize($uploaddir . '/templates'), $decimals);
Expand Down
8 changes: 6 additions & 2 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -6176,8 +6176,12 @@ function folderSize($dir)
function humanFilesize($bytes, $decimals = 2)
{
$sz = 'BKMGTP';
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
//$factor = floor((strlen($bytes) - 1) / 3);
$factor = 2;
$string = sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
$aLangData = getLanguageData();
$radix = getRadixPointData($aLangData[Yii::app()->session['adminlang']]['radixpoint']);
return str_replace('.', $radix['separator'], $string);
}

/**
Expand Down

2 comments on commit e94f989

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg, this french user … 😤

@olleharstedt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The radix? It's ',' in Germany, too.

Please sign in to comment.