Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion lib/SystemStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

use OC\Files\View;
use OC\Installer;
use OCP\Files\FileInfo;
use OCP\IConfig;
use OCP\App\IAppManager;
use bantu\IniGetWrapper\IniGetWrapper;
Expand Down Expand Up @@ -77,7 +78,7 @@ public function getSystemStatistics() {
'filelocking.enabled' => $this->config->getSystemValue('filelocking.enabled', true) ? 'yes' : 'no',
'memcache.locking' => $this->config->getSystemValue('memcache.locking', 'none'),
'debug' => $this->config->getSystemValue('debug', false) ? 'yes' : 'no',
'freespace' => $this->view->free_space(),
'freespace' => $this->getFreeSpace(),
'cpuload' => $processorUsage['loadavg'],
'mem_total' => $memoryUsage['mem_total'],
'mem_free' => $memoryUsage['mem_free'],
Expand Down Expand Up @@ -222,4 +223,20 @@ protected function getProcessorUsage() {
'loadavg' => $loadavg
];
}

/**
* Get free space if it can be calculated.
*
* @return mixed free space or null
* @throws \OCP\Files\InvalidPathException
*/
protected function getFreeSpace() {
$free_space = $this->view->free_space();
if ($free_space === FileInfo::SPACE_UNKNOWN
|| $free_space === FileInfo::SPACE_UNLIMITED
|| $free_space === FileInfo::SPACE_NOT_COMPUTED) {
return null;
}
return $free_space;
}
}
5 changes: 3 additions & 2 deletions templates/settings-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ function FormatMegabytes($byte) {

<p><?php p($l->t('Files:')); ?> <strong id="numFilesStorage"><?php p($_['storage']['num_files']); ?></strong></p>
<p><?php p($l->t('Storages:')); ?> <strong id="numFilesStorages"><?php p($_['storage']['num_storages']); ?></strong></p>
<p><?php p($l->t('Free Space:')); ?> <strong id="systemDiskFreeSpace"><?php p($_['system']['freespace']); ?></strong>
</p>
<?php if ($_['system']['freespace'] !== null): ?>
<p><?php p($l->t('Free Space:')); ?> <strong id="systemDiskFreeSpace"><?php p($_['system']['freespace']); ?></strong></p>
<?php endif; ?>
</div>

<!-- NETWORK -->
Expand Down