Get quota information on the main-page patching code

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Get quota information on the main-page patching code


I want to tweak , the front page by adding Quota information. I did my best to get the information from the hidden fields such as "usedSpacePercent" and "free_space" displayed on the main-page. For this , I learned a little from /apps/files/js/files.js with the relevant section looks like:-

if ( !== undefined && !== undefined) {

The problem is that there is no 'quota' information present in the files.js, falling the call-tree of files.js to "getstoragestats.php" which lands  to "/apps/files/lib/Helper.php" contains 

public static function buildFileStorageStatistics($dir) {
// information about storage capacities
$storageInfo = \OC_Helper::getStorageInfo($dir);
$l = new \OC_L10N('files');
$maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);
$maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);
$maxHumanFileSize = $l->t('Upload (max. %s)', array($maxHumanFileSize));
return [
'uploadMaxFilesize' => $maxUploadFileSize,
'maxHumanFilesize'  => $maxHumanFileSize,
'freeSpace' => $storageInfo['free'],
'usedSpacePercent'  => (int)$storageInfo['relative'],
'owner' => $storageInfo['owner'],
'ownerDisplayName' => $storageInfo['ownerDisplayName'],

no return of 'Quota' value from "getStorageInfo()" defined here "lib/private/legacy/helper.php' as

$ownerId = $storage->getOwner($path);
$ownerDisplayName = '';
$owner = \OC::$server->getUserManager()->get($ownerId);
if($owner) {
$ownerDisplayName = $owner->getDisplayName();
return [
'free' => $free,
'used' => $used,
'quota' => $quota,
'total' => $total,
'relative' => $relative,
'owner' => $ownerId,
'ownerDisplayName' => $ownerDisplayName,

I'm thinking of thus patching the  files.js as
and files/lib/Helper.php as
'quota' => $storageInfo['quota'],

After, that I can use JS, to call the id against  whatever HTML element i.e span or div on the main-page. Please suggest?


User mailing list
[hidden email]