cdd07b3339
DRYing the code by using \OCA\files\lib\Helper::buildFileStorageStatistics() now returning used space percent on each ajax call
20 lines
597 B
PHP
20 lines
597 B
PHP
<?php
|
|
|
|
namespace OCA\files\lib;
|
|
|
|
class Helper
|
|
{
|
|
public static function buildFileStorageStatistics($dir) {
|
|
$l = new \OC_L10N('files');
|
|
$maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir);
|
|
$maxHumanFilesize = \OCP\Util::humanFileSize($maxUploadFilesize);
|
|
$maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize;
|
|
|
|
// information about storage capacities
|
|
$storageInfo = \OC_Helper::getStorageInfo();
|
|
|
|
return array('uploadMaxFilesize' => $maxUploadFilesize,
|
|
'maxHumanFilesize' => $maxHumanFilesize,
|
|
'usedSpacePercent' => (int)$storageInfo['relative']);
|
|
}
|
|
}
|