diff --git a/web/includes/functions.php b/web/includes/functions.php index fa8a0aba9..dcbb448b7 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -1207,7 +1207,7 @@ function parseFilter( &$filter, $saveToSession=false, $querySep='&' ) { } // end foreach remaining term } // end no StorageArea found yet - $filter['sql'] .= getDiskPercent( $StorageArea ); + $filter['sql'] .= getDiskPercent( $StorageArea->Path() ); break; case 'DiskBlocks': // Need to specify a storage area, so need to look through other terms looking for a storage area, else we default to ZM_EVENTS_PATH @@ -1410,10 +1410,18 @@ function getLoad() { return( $load[0] ); } -function getDiskPercent( $StorageArea = NULL ) { - if ( ! $StorageArea ) $StorageArea = new Storage(); - - return $StorageArea->disk_usage_percent(); +function getDiskPercent($path = ZM_DIR_EVENTS) { + $total = disk_total_space($path); + if ( ! $total ) { + Error("disk_total_space returned false for " . $path ); + return 0; + } + $free = disk_free_space($path); + if ( ! $free ) { + Error("disk_free_space returned false for " . $path ); + } + $space = round(($total - $free) / $total * 100); + return( $space ); } function getDiskBlocks() { diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 607a4d1c5..6e8c03af8 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -269,6 +269,7 @@ if ( canView( 'Stream' ) && $cycleCount > 1 ) { $func = function($S){ return $S->Name() . ': ' . $S->disk_usage_percent().'%'; }; echo implode( ', ', array_map ( $func, $storage_areas ) ); + echo ' ' . ZM_PATH_MAP .': '. getDiskPercent(ZM_PATH_MAP).'%'; ?> diff --git a/web/skins/classic/views/controlcap.php b/web/skins/classic/views/controlcap.php index 2a898de9c..88e0d1212 100644 --- a/web/skins/classic/views/controlcap.php +++ b/web/skins/classic/views/controlcap.php @@ -183,7 +183,7 @@ foreach ( $tabs as $name=>$value ) ?>
-