Use underscores in graph hook scripts

Underscores are translated to space for display in the GUI
This commit is contained in:
bergware
2023-12-15 19:04:50 +01:00
parent c7f445f167
commit 7e53df6924
4 changed files with 4 additions and 4 deletions

View File

@@ -74,8 +74,8 @@ $dot = _var($display,'number','.,')[0];
$zfs = count(array_filter(array_column($disks,'fsType'),function($fs){return str_replace('luks:','',$fs??'')=='zfs';}));
// enable/disable graph elements by making hook script executable or not
chmod("$docroot/webGui/system/VM usage",$libvirtd ? 0755 : 0644);
chmod("$docroot/webGui/system/ZFS cache",$zfs ? 0755 : 0644);
chmod("$docroot/webGui/system/VM_usage",$libvirtd ? 0755 : 0644);
chmod("$docroot/webGui/system/ZFS_cache",$zfs ? 0755 : 0644);
foreach ($disks as $disk) {
switch (_var($disk,'type')) {

View File

@@ -65,8 +65,8 @@ while (true) {
foreach ($hooks as $hook) {
$data = @intval(exec(escapeshellarg($hook)));
if (!$data || $data>$used) continue;
$names[] = _(basename($hook)); // name of element (with translation)
$bytes[] = $data; // value in bytes of element
$names[] = _(basename(str_replace('_',' ',$hook))); // name of element (with translation)
$bytes[] = $data; // value in bytes of element
}
$services = $used-array_sum($bytes);
$meminfo[] = round(100*$used/$total)."%";