mirror of
https://github.com/unraid/webgui.git
synced 2026-05-03 08:19:27 -05:00
PHP8 support
This commit is contained in:
@@ -1203,7 +1203,7 @@ dashboard.on('message',function(msg,meta) {
|
||||
// memory & disk load
|
||||
$.each(part[0].split('\0'),function(k,v) {
|
||||
var load = v.slice(0,-1);
|
||||
var color = setColor(load, <?=$display['critical']?>, <?=$display['warning']?>);
|
||||
var color = setColor(load,<?=_var($display,'critical',0)?>,<?=_var($display,'warning',0)?>);
|
||||
$('.sys'+k).text(v);
|
||||
$('#sys'+k).finish().animate({width:v},{step:function(){$('#sys'+k).css('overflow','visible').removeClass().addClass(color);}});
|
||||
});
|
||||
|
||||
@@ -21,7 +21,7 @@ $events = explode('|',$var['smEvents'] ?? $numbers);
|
||||
|
||||
function displayTemp($temp) {
|
||||
global $display;
|
||||
return $display['unit']=='F' ? round(9/5*$temp)+32 : $temp;
|
||||
return (is_numeric($temp) && _var($display,'unit')=='F') ? round(9/5*$temp)+32 : $temp;
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
@@ -30,7 +30,7 @@ span.code{display:inline-block;width:186px}
|
||||
<script>
|
||||
function doDispatch(form) {
|
||||
var fields = {};
|
||||
<?if ($display['unit']=='F'):?>
|
||||
<?if (_var($display,'unit')=='F'):?>
|
||||
form.display_hot.value = Math.round((form.display_hot.value-32)*5/9);
|
||||
form.display_max.value = Math.round((form.display_max.value-32)*5/9);
|
||||
<?endif;?>
|
||||
@@ -166,22 +166,22 @@ _(Tunable (md_write_method))_:
|
||||
:disk_tunable_md_write_method_help:
|
||||
|
||||
_(Default warning disk utilization threshold)_ (%):
|
||||
: <input type="number" min="0" max="100" name="display_warning" class="narrow" value="<?=$display['warning']?>">
|
||||
: <input type="number" min="0" max="100" name="display_warning" class="narrow" value="<?=_var($display,'warning')?>">
|
||||
|
||||
:disk_default_warning_utilization_help:
|
||||
|
||||
_(Default critical disk utilization threshold)_ (%):
|
||||
: <input type="number" min="0" max="100" name="display_critical" class="narrow" value="<?=$display['critical']?>">
|
||||
: <input type="number" min="0" max="100" name="display_critical" class="narrow" value="<?=_var($display,'critical')?>">
|
||||
|
||||
:disk_default_critical_utilization_help:
|
||||
|
||||
_(Default warning disk temperature threshold)_ (°<?=$display['unit']?>):
|
||||
: <input type="number" min="0" max="300" name="display_hot" class="narrow" value="<?=displayTemp($display['hot'])?>">
|
||||
_(Default warning disk temperature threshold)_ (°<?=_var($display,'unit','C')?>):
|
||||
: <input type="number" min="0" max="300" name="display_hot" class="narrow" value="<?=displayTemp(_var($display,'hot'))?>">
|
||||
|
||||
:disk_default_warning_temperature_help:
|
||||
|
||||
_(Default critical disk temperature threshold)_ (°<?=$display['unit']?>):
|
||||
: <input type="number" min="0" max="300" name="display_max" class="narrow" value="<?=displayTemp($display['max'])?>">
|
||||
_(Default critical disk temperature threshold)_ (°<?=_var($display,'unit','C')?>):
|
||||
: <input type="number" min="0" max="300" name="display_max" class="narrow" value="<?=displayTemp(_var($display,'max'))?>">
|
||||
|
||||
:disk_default_critical_temperature_help:
|
||||
|
||||
@@ -200,49 +200,49 @@ _(Default critical disk temperature threshold)_ (°<?=$display['unit']?>):
|
||||
<input type="hidden" name="smIndex" value="0">
|
||||
_(Default SMART notification value)_:
|
||||
: <select name="smSelect" size="1">
|
||||
<?=mk_option($var['smSelect']??'', "0", _('Raw'))?>
|
||||
<?=mk_option($var['smSelect']??'', "1", _('Normalized'))?>
|
||||
<?=mk_option(_var($var,'smSelect'), "0", _('Raw'))?>
|
||||
<?=mk_option(_var($var,'smSelect'), "1", _('Normalized'))?>
|
||||
</select>
|
||||
|
||||
:disk_default_smart_notification_help:
|
||||
|
||||
_(Default SMART notification tolerance level)_:
|
||||
: <select name="smLevel" size="1">
|
||||
<?=mk_option($var['smLevel']??'', "1.00", _('Absolute'))?>
|
||||
<?=mk_option($var['smLevel']??'', "1.05", "5%")?>
|
||||
<?=mk_option($var['smLevel']??'', "1.10", "10%")?>
|
||||
<?=mk_option($var['smLevel']??'', "1.15", "15%")?>
|
||||
<?=mk_option($var['smLevel']??'', "1.20", "20%")?>
|
||||
<?=mk_option($var['smLevel']??'', "1.25", "25%")?>
|
||||
<?=mk_option($var['smLevel']??'', "1.50", "50%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.00", _('Absolute'))?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.05", "5%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.10", "10%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.15", "15%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.20", "20%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.25", "25%")?>
|
||||
<?=mk_option(_var($var,'smLevel'), "1.50", "50%")?>
|
||||
</select>
|
||||
|
||||
:disk_default_smart_tolerance_help:
|
||||
|
||||
_(Default SMART controller type)_:
|
||||
: <select name="smType" size="1" onchange="setIndex(this.form)">
|
||||
<?=mk_option($var['smType']??'', "", _('Automatic'))?>
|
||||
<?=mk_option($var['smType']??'', "-d ata", "ATA")?>
|
||||
<?=mk_option($var['smType']??'', "-d nvme", "NVMe")?>
|
||||
<?=mk_option($var['smType']??'', "-d sat", "SAT")?>
|
||||
<?=mk_option($var['smType']??'', "-d scsi", "SCSI")?>
|
||||
<?=mk_option($var['smType']??'', "-d 3ware", "3Ware")?>
|
||||
<?=mk_option($var['smType']??'', "-d aacraid", "Adaptec")?>
|
||||
<?=mk_option($var['smType']??'', "-d areca", "Areca")?>
|
||||
<?=mk_option($var['smType']??'', "-d hpt", "HighPoint")?>
|
||||
<?=mk_option($var['smType']??'', "-d cciss", "HP cciss")?>
|
||||
<?=mk_option($var['smType']??'', "-d marvell", "Marvell")?>
|
||||
<?=mk_option($var['smType']??'', "-d megaraid", "MegaRAID")?>
|
||||
<?=mk_option(_var($var,'smType'), "", _('Automatic'))?>
|
||||
<?=mk_option(_var($var,'smType'), "-d ata", "ATA")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d nvme", "NVMe")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d sat", "SAT")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d scsi", "SCSI")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d 3ware", "3Ware")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d aacraid", "Adaptec")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d areca", "Areca")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d hpt", "HighPoint")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d cciss", "HP cciss")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d marvell", "Marvell")?>
|
||||
<?=mk_option(_var($var,'smType'), "-d megaraid", "MegaRAID")?>
|
||||
</select>
|
||||
|
||||
:disk_default_smart_controller_help:
|
||||
|
||||
_(Default SMART attribute notifications)_:
|
||||
: <input type="text" name="smCustom" value="<?=$var['smCustom']??''?>" class="narrow">_(Custom attributes (use comma to separate numbers))_
|
||||
: <input type="text" name="smCustom" value="<?=_var($var,'smCustom')?>" class="narrow">_(Custom attributes (use comma to separate numbers))_
|
||||
|
||||
<?for ($x = 0; $x < count($preselect); $x++):?>
|
||||
|
||||
: <input type="checkbox" name="at<?=$x?>" value="<?=$preselect[$x]['code']??''?>"<?=in_array($preselect[$x]['code']??'',$events)?' checked':''?>><span class="code">_(Attribute)_ = <?=$preselect[$x]['code']?></span><?=$preselect[$x]['text']?>
|
||||
: <input type="checkbox" name="at<?=$x?>" value="<?=_var($preselect[$x],'code')?>"<?=in_array(_var($preselect[$x],'code'),$events)?' checked':''?>><span class="code">_(Attribute)_ = <?=_var($preselect[$x],'code')?></span><?=_var($preselect[$x],'text')?>
|
||||
<?endfor;?>
|
||||
|
||||
:disk_default_smart_attribute_help:
|
||||
|
||||
@@ -117,15 +117,15 @@ function my_usage() {
|
||||
function usage_color(&$disk, $limit, $free) {
|
||||
global $display;
|
||||
if (_var($display,'text',0)==1 || intval(_var($display,'text',0)/10)==1) return '';
|
||||
$critical = $disk['critical'] ?? $display['critical'] ?? 0;
|
||||
$warning = $disk['warning'] ?? $display['warning'] ?? 0;
|
||||
$critical = ($disk['critical'] ?? $display['critical'] ?? 0) ?: 0;
|
||||
$warning = ($disk['warning'] ?? $display['warning'] ?? 0) ?: 0;
|
||||
if (!$free) {
|
||||
if ($limit>=$critical && $critical>0) return 'redbar';
|
||||
if ($limit>=$warning && $warning>0) return 'orangebar';
|
||||
if ($critical>0 && $limit>=$critical) return 'redbar';
|
||||
if ($warning>0 && $limit>=$warning) return 'orangebar';
|
||||
return 'greenbar';
|
||||
} else {
|
||||
if ($limit<=100-$critical && $critical>0) return 'redbar';
|
||||
if ($limit<=100-$warning && $warning>0) return 'orangebar';
|
||||
if ($critical>0 && $limit<=100-$critical) return 'redbar';
|
||||
if ($warning>0 && $limit<=100-$warning) return 'orangebar';
|
||||
return 'greenbar';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,10 +208,10 @@ function device_usage(&$disk, &$full, &$high) {
|
||||
if ($used) {
|
||||
if ($text==2 || $text==21) {
|
||||
$load = substr($used,0,-1);
|
||||
$critical = $disk['critical'] ?? $display['critical'] ?? 0;
|
||||
$warning = $disk['warning'] ?? $display['warning'] ?? 0;
|
||||
if ($critical > 0 && $load >= $critical) {$class = 'redbar'; $full++;}
|
||||
elseif ($warning > 0 && $load >= $warning) {$class = 'orangebar'; $high++;}
|
||||
$critical = ($disk['critical'] ?? $display['critical'] ?? 0) ?: 0;
|
||||
$warning = ($disk['warning'] ?? $display['warning'] ?? 0) ?: 0;
|
||||
if ($critical>0 && $load>=$critical) {$class = 'redbar'; $full++;}
|
||||
elseif ($warning>0 && $load>=$warning) {$class = 'orangebar'; $high++;}
|
||||
else $class = 'greenbar';
|
||||
}
|
||||
else
|
||||
@@ -322,7 +322,7 @@ while (true) {
|
||||
}
|
||||
if ($spot) {
|
||||
$number = _var($display,'number','.,');
|
||||
$action = preg_split('/\s+/',$var['mdResyncAction']);
|
||||
$action = preg_split('/\s+/',_var($var,'mdResyncAction'));
|
||||
switch ($action[0]) {
|
||||
case "recon": $mode = $action[1]=='P' ? 'Parity-Sync' : 'Data-Rebuild'; break;
|
||||
case "check": $mode = count($action)>1 ? 'Parity-Check' : 'Read-Check'; break;
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
#!/usr/bin/php
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
require_once "/usr/local/emhttp/webGui/include/publish.php";
|
||||
function emhttp_command($cmd)
|
||||
{
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$cmd .= "&csrf_token={$var['csrf_token']}";
|
||||
return curl_socket("/var/run/emhttpd.socket", "http://localhost/update", $cmd);
|
||||
|
||||
function emhttp_command($cmd) {
|
||||
$var = @parse_ini_file("/var/local/emhttp/var.ini") ?: [];
|
||||
$cmd .= "&csrf_token=".($var['csrf_token']??'');
|
||||
return curl_socket("/var/run/emhttpd.socket", "http://localhost/update", $cmd);
|
||||
}
|
||||
$result = emhttp_command($argv[1]);
|
||||
if ($result == "") exit(0);
|
||||
echo "$result".PHP_EOL;
|
||||
exit(1);
|
||||
|
||||
$error = !empty($argv[1]) ? emhttp_command($argv[1]) : '';
|
||||
if ($error) {
|
||||
echo "$error\n";
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -19,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = '';
|
||||
$login_locale = $display['locale'];
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
// if no user(s) specified, deletes the config file
|
||||
|
||||
$config_file = "/boot/config/vsftpd.user_list";
|
||||
if (trim($argv[2]))
|
||||
if (isset($argv[2]))
|
||||
file_put_contents($config_file, implode("\n", explode(' ', trim($argv[2])))."\n");
|
||||
else
|
||||
@unlink($config_file);
|
||||
|
||||
$state = $argv[1] ? "'s/^#\(ftp.*vsftpd\)\$/\\1/'" : "'s/^\(ftp.*vsftpd\)\$/#\\1/'";
|
||||
$state = !empty($argv[1]) ? "'s/^#\(ftp.*vsftpd\)\$/\\1/'" : "'s/^\(ftp.*vsftpd\)\$/#\\1/'";
|
||||
exec("sed -i $state /etc/inetd.conf");
|
||||
exec("killall -HUP inetd");
|
||||
?>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -26,7 +26,7 @@ function write(...$messages){
|
||||
curl_close($com);
|
||||
}
|
||||
|
||||
$url = rawurldecode($argv[1]);
|
||||
$url = rawurldecode($argv[1]??'');
|
||||
$host = parse_url($url)['host'];
|
||||
|
||||
if (in_array($host,['keys.lime-technology.com','lime-technology.com'])) {
|
||||
|
||||
@@ -21,9 +21,9 @@ if (!function_exists('_')) {
|
||||
// Exit when settings are not yet initialized
|
||||
if (!file_exists("/var/local/emhttp/var.ini")) exit;
|
||||
|
||||
$var = (array)parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$devs = (array)parse_ini_file("/var/local/emhttp/devs.ini",true);
|
||||
$disks = (array)parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
$var = @parse_ini_file("/var/local/emhttp/var.ini") ?: [];
|
||||
$devs = @parse_ini_file("/var/local/emhttp/devs.ini",true) ?: [];
|
||||
$disks = @parse_ini_file("/var/local/emhttp/disks.ini",true) ?: [];
|
||||
|
||||
require_once "$docroot/webGui/include/Helpers.php";
|
||||
require_once "$docroot/webGui/include/Preselect.php";
|
||||
@@ -35,19 +35,19 @@ $notify = "$docroot/webGui/scripts/notify";
|
||||
$ram = "/var/local/emhttp/monitor.ini";
|
||||
$rom = "/boot/config/plugins/dynamix/monitor.ini";
|
||||
$saved = @parse_ini_file($ram,true);
|
||||
$high1 = $display['critical'];
|
||||
$high2 = $display['warning'];
|
||||
$server = strtoupper($var['NAME']);
|
||||
$high1 = _var($display,'critical',0);
|
||||
$high2 = _var($display,'warning',0);
|
||||
$server = strtoupper(_var($var,'NAME','tower'));
|
||||
$pools = pools_filter($disks);
|
||||
$errors = [];
|
||||
$top = 120;
|
||||
|
||||
function check_temp(&$disk,$text,$info) {
|
||||
global $notify,$saved,$server,$display,$top;
|
||||
$name = $disk['name'];
|
||||
$temp = $disk['temp'];
|
||||
$hot = $disk['hotTemp'] ?? $display['hot'] ?? 0;
|
||||
$max = $disk['maxTemp'] ?? $display['max'] ?? 0;
|
||||
$name = _var($disk,'name');
|
||||
$temp = _var($disk,'temp','*');
|
||||
$max = ($disk['maxTemp'] ?? $display['max'] ?? 0) ?: 0;
|
||||
$hot = ($disk['hotTemp'] ?? $display['hot'] ?? 0) ?: 0;
|
||||
$warn = exceed($temp,$max,$top) ? 'alert' : (exceed($temp,$hot,$top) ? 'warning' : false);
|
||||
$item = 'temp';
|
||||
$last = $saved[$item][$name] ?? 0;
|
||||
@@ -65,7 +65,7 @@ function check_temp(&$disk,$text,$info) {
|
||||
}
|
||||
function check_smart(&$disk,$port,$text,$info) {
|
||||
global $notify,$saved,$server,$numbers;
|
||||
$name = $disk['name'];
|
||||
$name = _var($disk,'name');
|
||||
$select = get_value($disk,'smSelect',0);
|
||||
$level = get_value($disk,'smLevel',1);
|
||||
$events = explode('|',get_value($disk,'smEvents',$numbers));
|
||||
@@ -122,9 +122,9 @@ function check_smart(&$disk,$port,$text,$info) {
|
||||
function check_usage(&$disk,$used,$text,$info) {
|
||||
global $notify,$saved,$server,$display;
|
||||
if ($used == -1) return;
|
||||
$name = $disk['name'];
|
||||
$warning = is_numeric($disk['warning']) ? $disk['warning'] : $display['warning'];
|
||||
$critical = is_numeric($disk['critical']) ? $disk['critical'] : $display['critical'];
|
||||
$name = _var($disk,'name');
|
||||
$critical = ($disk['critical'] ?? $display['critical'] ?? 0) ?: 0;
|
||||
$warning = ($disk['warning'] ?? $display['warning'] ?? 0) ?: 0;
|
||||
$warn = exceed($used,$critical) ? 'alert' : (exceed($used,$warning) ? 'warning' : false);
|
||||
$item = 'used';
|
||||
$last = $saved[$item][$name] ?? 0;
|
||||
@@ -143,25 +143,26 @@ function check_usage(&$disk,$used,$text,$info) {
|
||||
|
||||
// check array devices
|
||||
foreach ($disks as $disk) {
|
||||
$name = $disk['name'];
|
||||
if ($name=='flash' || substr($disk['status'],-3)=='_NP') continue;
|
||||
$name = _var($disk,'name');
|
||||
if ($name=='flash' || substr(_var($disk,'status'),-3)=='_NP') continue;
|
||||
$text = my_disk($name).(in_array($name,$pools)||$name=='parity'?' disk':'');
|
||||
$info = !empty($disk['id']) ? "{$disk['id']} ({$disk['device']})" : "No device identification ({$disk['device']})";
|
||||
$device = _var($disk,'device');
|
||||
$info = !empty($disk['id']) ? "{$disk['id']} ($device)" : "No device identification ($device)";
|
||||
// process disk temperature notifications
|
||||
check_temp($disk,$text,$info);
|
||||
// process disk SMART notifications
|
||||
check_smart($disk,port_name($disk['smDevice'] ?? $disk['device']),$text,$info);
|
||||
check_smart($disk,port_name($disk['smDevice'] ?? $device),$text,$info);
|
||||
// process disk usage notifications
|
||||
check_usage($disk,isset($disk['fsSize'])&&$disk['fsSize']>0?100-round(100*$disk['fsFree']/$disk['fsSize']):-1,$text,$info);
|
||||
check_usage($disk,_var($disk,'fsSize',0)>0?100-round(100*_var($disk,'fsFree',0)/$disk['fsSize']):-1,$text,$info);
|
||||
// process disk operation notifications
|
||||
$warn = strtok($disk['color'],'-');
|
||||
$warn = strtok(_var($disk,'color'),'-');
|
||||
$item = 'disk';
|
||||
$last = $saved[$item][$name] ?? '';
|
||||
switch ($warn) {
|
||||
case 'red':
|
||||
if ($warn!=$last) {
|
||||
if ($var['fsState']!='Stopped') {
|
||||
$status = strtolower(str_replace(['NP_','_'],['',' '],$disk['status']));
|
||||
if (_var($var,'fsState')!='Stopped') {
|
||||
$status = strtolower(str_replace(['NP_','_'],['',' '],_var($disk,'status')));
|
||||
exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text error")." -s ".escapeshellarg("Alert [$server] - $text in error state ($status)")." -d ".escapeshellarg("$info")." -i \"alert\" 2>/dev/null");
|
||||
}
|
||||
$saved[$item][$name] = $warn;
|
||||
@@ -169,7 +170,7 @@ foreach ($disks as $disk) {
|
||||
break;
|
||||
case 'yellow':
|
||||
if ($warn!=$last) {
|
||||
if ($var['fsState']!='Stopped') {
|
||||
if (_var($var,'fsState')!='Stopped') {
|
||||
$status = $name=='parity' ? "parity-sync in progress" : " is being reconstructed and is available for normal operation";
|
||||
exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text, $status")." -d ".escapeshellarg("$info")." 2>/dev/null");
|
||||
}
|
||||
@@ -178,19 +179,19 @@ foreach ($disks as $disk) {
|
||||
break;
|
||||
default:
|
||||
if ($last) {
|
||||
if ($var['fsState']!='Stopped') {
|
||||
if (_var($var,'fsState')!='Stopped') {
|
||||
exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Notice [$server] - $text returned to normal operation")." -d ".escapeshellarg("$info")." 2>/dev/null");
|
||||
}
|
||||
unset($saved[$item][$name]);
|
||||
}
|
||||
break;}
|
||||
// count disk errors
|
||||
if ($disk['numErrors']>0) $errors[] = "$text - $info (errors {$disk['numErrors']})";
|
||||
if (_var($disk,'numErrors',0)>0) $errors[] = "$text - $info (errors {$disk['numErrors']})";
|
||||
// check file system of cache pool
|
||||
$item = 'pool';
|
||||
if (in_array($name,$pools) && strpos($disk['fsType']??'','btrfs')!==false) {
|
||||
if (in_array($name,$pools) && strpos(_var($disk,'fsType'),'btrfs')!==false) {
|
||||
$attr = 'missing';
|
||||
if (exec("/sbin/btrfs filesystem show {$disk['uuid']} 2>/dev/null|grep -c 'missing'")>0) {
|
||||
if (exec("/sbin/btrfs filesystem show "._var($disk,'uuid')." 2>/dev/null|grep -c 'missing'")>0) {
|
||||
if (empty($saved[$item][$attr])) {
|
||||
exec("$notify -l '/Main' -e ".escapeshellarg("Unraid $text message")." -s ".escapeshellarg("Warning [$server] - Cache pool BTRFS missing device(s)")." -d ".escapeshellarg("$info")." -i \"warning\" 2>/dev/null");
|
||||
$saved[$item][$attr] = 1;
|
||||
@@ -208,8 +209,8 @@ foreach ($disks as $disk) {
|
||||
|
||||
// check unassigned devices
|
||||
foreach ($devs as $dev) {
|
||||
$name = $dev['name'];
|
||||
$id = $dev['id'];
|
||||
$name = _var($dev,'name','no name');
|
||||
$id = _var($dev,'id');
|
||||
$port = port_name($name);
|
||||
$text = "device $name";
|
||||
$info = !empty($id) ? "$id ($name)": "No device identification ($name)";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/php -q
|
||||
<?
|
||||
# Copyright 2005-2022, Lime Technology
|
||||
# Copyright 2005-2023, Lime Technology
|
||||
#
|
||||
# Usage: newperms [dir] [owner] [group]
|
||||
# Recursively changes the ownership and permissions of the directory and all files/subdirs
|
||||
@@ -42,8 +42,8 @@ function write(...$messages){
|
||||
}
|
||||
function process($path) {
|
||||
global $argv;
|
||||
$owner = $argv[2] ?: 'nobody';
|
||||
$group = $argv[3] ?: 'users';
|
||||
$owner = $argv[2] ?? 'nobody';
|
||||
$group = $argv[3] ?? 'users';
|
||||
if (is_dir($path)) {
|
||||
write("Processing: $path\n", "... chmod -R u-x,go-rwx,go+u,ugo+X $path\n");
|
||||
exec("chmod -R u-x,go-rwx,go+u,ugo+X ".escapeshellarg($path));
|
||||
@@ -57,7 +57,7 @@ function process($path) {
|
||||
|
||||
$startTime = time();
|
||||
|
||||
if ($argv[1]) {
|
||||
if ($argv[1]??'') {
|
||||
$paths = explode('*',rawurldecode($argv[1]));
|
||||
foreach ($paths as $path) process($path);
|
||||
} else {
|
||||
@@ -69,7 +69,7 @@ if ($argv[1]) {
|
||||
|
||||
$time = time()-$startTime;
|
||||
$hours = floor($time/3600);
|
||||
$mins = floor($time/60%60);
|
||||
$mins = floor($time/60)%60;
|
||||
$secs = floor($time%60);
|
||||
|
||||
write("Completed, elapsed time: ".sprintf('%02d:%02d:%02d', $hours, $mins, $secs)."\n");
|
||||
|
||||
@@ -51,16 +51,13 @@ EOT;
|
||||
|
||||
function generate_email($event, $subject, $description, $importance, $message, $recipients, $fqdnlink) {
|
||||
global $ssmtp;
|
||||
|
||||
$rcpt = $ssmtp['RcptTo'];
|
||||
if (!$recipients)
|
||||
$to = implode(',', explode(' ', trim($rcpt)));
|
||||
else
|
||||
$to = $recipients;
|
||||
if (empty($to)) return;
|
||||
|
||||
$subj = "{$ssmtp['Subject']}$subject";
|
||||
|
||||
$headers = [];
|
||||
$headers[] = "MIME-Version: 1.0";
|
||||
$headers[] = "X-Mailer: PHP/".phpversion();
|
||||
@@ -72,7 +69,6 @@ function generate_email($event, $subject, $description, $importance, $message, $
|
||||
$headers[] = "X-Mms-Priority: High";
|
||||
}
|
||||
$headers[] = "";
|
||||
|
||||
$body = [];
|
||||
if (!empty($fqdnlink)) {
|
||||
$body[] = "Link: $fqdnlink";
|
||||
@@ -88,7 +84,6 @@ function generate_email($event, $subject, $description, $importance, $message, $
|
||||
$body[] = $line;
|
||||
}
|
||||
$body[] = "";
|
||||
|
||||
return mail($to, $subj, implode("\n", $body), implode("\n", $headers));
|
||||
}
|
||||
|
||||
@@ -104,8 +99,10 @@ function safe_filename($string) {
|
||||
if ($argc == 1) exit(usage());
|
||||
|
||||
extract(parse_plugin_cfg("dynamix",true));
|
||||
$unread = "{$notify['path']}/unread";
|
||||
$archive = "{$notify['path']}/archive";
|
||||
|
||||
$path = _var($notify,'path','/tmp/notifications');
|
||||
$unread = "$path/unread";
|
||||
$archive = "$path/archive";
|
||||
$agents_dir = "/boot/config/plugins/dynamix/notifications/agents";
|
||||
if (is_dir($agents_dir)) {
|
||||
$agents = [];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
|
||||
@@ -19,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'main';
|
||||
$login_locale = $display['locale'];
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
$month = [' Jan '=>'-01-',' Feb '=>'-02-',' Mar '=>'-03-',' Apr '=>'-04-',' May '=>'-05-',' Jun '=>'-06-',' Jul '=>'-07-',' Aug '=>'-08-',' Sep '=>'-09-',' Oct '=>'-10-',' Nov '=>'-11-',' Dec '=>'-12-'];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -19,7 +19,7 @@ $last = "\e[0m";
|
||||
$color = ['text' => $last, 'error' => "\e[91m", 'warn' => "\e[93m", 'system' => "\e[96m", 'array' => "\e[92m", 'login' => "\e[95m"];
|
||||
$call = ['tail','docker','grep'];
|
||||
|
||||
if (!in_array($argv[1],$call)) exit;
|
||||
if (!in_array($argv[1]??'',$call)) exit;
|
||||
|
||||
$dummy = array_shift($argv);
|
||||
$files = array_pop($argv);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -19,13 +19,12 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'dashboard';
|
||||
$login_locale = $display['locale'];
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
$boot = "/boot/config/plugins/dynamix";
|
||||
$file = $argv[1];
|
||||
$exist = is_file("$boot/$file");
|
||||
$cmodel = $exist ? file_get_contents("$boot/$file") : '';
|
||||
$cmodel = is_file("$boot/$file") ? file_get_contents("$boot/$file") : '';
|
||||
|
||||
$style = ["<style>"];
|
||||
$style[] = "div.case-list{float:left;padding:10px;margin:0 45px 64px 0;height:128px;width:128px;text-align:center;cursor:pointer}";
|
||||
@@ -54,7 +53,7 @@ $script[] = "}";
|
||||
$script[] = "</script>";
|
||||
|
||||
$html = ["<div>"];
|
||||
$cases = explode("\n",file_get_contents("$docroot/webGui/styles/default-cases.css"));
|
||||
$cases = file("$docroot/webGui/styles/default-cases.css",FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($cases as $case) if (substr($case,0,6)=='.case-') $models[] = substr($case,1,strpos($case,':')-1);
|
||||
natsort($models);
|
||||
for ($i=0; $i < count($models); $i++) {
|
||||
|
||||
@@ -20,7 +20,7 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'settings';
|
||||
$login_locale = $display['locale']??'';
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
function write(...$messages){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -12,41 +12,37 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$var = parse_ini_file("/var/local/emhttp/var.ini");
|
||||
$disks = parse_ini_file("/var/local/emhttp/disks.ini",true);
|
||||
$var = @parse_ini_file("/var/local/emhttp/var.ini") ?: [];
|
||||
$disks = @parse_ini_file("/var/local/emhttp/disks.ini",true) ?: [];
|
||||
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/webGui/include/CustomMerge.php";
|
||||
|
||||
$notify = "$docroot/webGui/scripts/notify";
|
||||
$unraid = parse_plugin_cfg("dynamix",true);
|
||||
$output = $unraid['notify']['report'];
|
||||
$server = strtoupper($var['NAME']);
|
||||
$script = "$docroot/webGui/scripts/notify";
|
||||
extract(parse_plugin_cfg("dynamix",true));
|
||||
$output = _var($notify,'report');
|
||||
$server = strtoupper(_var($var,'NAME','tower'));
|
||||
$data = [];
|
||||
$parity = false;
|
||||
$cache = false;
|
||||
$error0 = 0;
|
||||
$error1 = 0;
|
||||
$error2 = 0;
|
||||
$error3 = 0;
|
||||
$parity = $pools = false;
|
||||
$error0 = $error1 = $error2 = $error3 = 0;
|
||||
|
||||
function plus($val, $word, $last) {
|
||||
return $val>0 ? (($val || $last) ? ($val.' '.$word.($val!=1?'s':'').($last ?'':', ')) : '') : '';
|
||||
}
|
||||
function my_temp($value) {
|
||||
global $unraid;
|
||||
global $display;
|
||||
if ($value=='*') return ' - standby';
|
||||
$unit = $unraid['display']['unit'];
|
||||
return ' - active '.($unit=='F' ? round(9/5*$value+32) : str_replace('.', $unraid['display']['number'][0], $value)).' '.$unit;
|
||||
$unit = _var($display,'unit','C');
|
||||
return ' - active '.($unit=='F' ? round(9/5*$value+32) : str_replace('.',_var($display,'number','.,')[0], $value)).' '.$unit;
|
||||
}
|
||||
function my_disk($name) {
|
||||
return ucfirst(preg_replace('/(\d+)$/',' $1',$name));
|
||||
}
|
||||
function my_scale($value, &$unit, $precision = NULL) {
|
||||
global $unraid;
|
||||
$scale = $unraid['display']['scale'];
|
||||
$number = $unraid['display']['number'];
|
||||
global $display;
|
||||
$scale = _var($display,'scale',-1);
|
||||
$number = _var($display,'number','.,');
|
||||
$units = ['B','KB','MB','GB','TB','PB'];
|
||||
if ($scale==0 && $precision===NULL) {
|
||||
$unit = '';
|
||||
@@ -65,13 +61,13 @@ function my_check($time,$speed) {
|
||||
$days = floor($time/86400);
|
||||
$hmss = $time-$days*86400;
|
||||
$hour = floor($hmss/3600);
|
||||
$mins = $hmss/60%60;
|
||||
$mins = floor($hmss/60)%60;
|
||||
$secs = $hmss%60;
|
||||
return plus($days,'day',($hour|$mins|$secs)==0).plus($hour,'hour',($mins|$secs)==0).plus($mins,'minute',$secs==0).plus($secs,'second',true).". Average speed: $speed";
|
||||
}
|
||||
function my_time($time) {
|
||||
global $unraid;
|
||||
$date = my_date($unraid['display']['date'].($unraid['display']['date']!='%c' ? ", {$unraid['display']['time']}" : ""), $time);
|
||||
global $display;
|
||||
$date = my_date(_var($display,'date').(_var($display,'date')!='%c' ? ", "._var($display,'time') : ""), $time);
|
||||
$now = new DateTime("@".intval(time()/86400)*86400);
|
||||
$last = new DateTime("@".intval($time/86400)*86400);
|
||||
$days = date_diff($last,$now)->format('%a');
|
||||
@@ -89,90 +85,87 @@ function my_time($time) {
|
||||
function my_clock($time) {
|
||||
if (!$time) return 'less than a minute';
|
||||
$days = floor($time/1440);
|
||||
$hour = $time/60%24;
|
||||
$hour = floor($time/60)%24;
|
||||
$mins = $time%60;
|
||||
return plus($days,'day',($hour|$mins)==0).plus($hour,'hour',$mins==0).plus($mins,'minute',true);
|
||||
}
|
||||
|
||||
function my_array(&$disk) {
|
||||
global $data,$unraid,$error0,$error1,$error2,$error3;
|
||||
$name = $disk['name'];
|
||||
$hot = $disk['hotTemp'] ?? $unraid['display']['hot'] ?? 0;
|
||||
$max = $disk['maxTemp'] ?? $unraid['display']['max'] ?? 0;
|
||||
if (strpos($disk['status'],'_NP')!==false) return false;
|
||||
$temp = $disk['temp'];
|
||||
if ($temp>=$max) {
|
||||
global $data,$display,$error0,$error1,$error2,$error3;
|
||||
$name = _var($disk,'name');
|
||||
$max = $disk['maxTemp'] ?? $display['max'] ?? 0;
|
||||
$hot = $disk['hotTemp'] ?? $display['hot'] ?? 0;
|
||||
if (strpos(_var($disk,'status'),'_NP')!==false) return false;
|
||||
$temp = _var($disk,'temp','*');
|
||||
if ($max>0 && $temp>=$max) {
|
||||
$fail = ' (disk is overheated';
|
||||
$error0++;
|
||||
} elseif ($temp>=$hot) {
|
||||
} elseif ($hot>0 && $temp>=$hot) {
|
||||
$fail = ' (disk is hot';
|
||||
$error1++;
|
||||
} else {
|
||||
$fail = '';
|
||||
}
|
||||
if ($disk['numErrors']>0) {
|
||||
if (_var($disk,'numErrors',0)>0) {
|
||||
if ($fail) $fail .= ', '; else $fail = ' (';
|
||||
$fail .= 'disk has read errors';
|
||||
$error2++;
|
||||
}
|
||||
if ($fail) $fail .= ')';
|
||||
$status = $fail ? ' [NOK]' : ' [OK]';
|
||||
$color = strtok($disk['color'],'-');
|
||||
if ($color=='red'||$color=='yellow') { $error3++; $status = ' ['.str_replace(['NP_','_'],['',' '],$disk['status']).']'; }
|
||||
$info = "{$disk['id']} ({$disk['device']})";
|
||||
$color = strtok(_var($disk,'color'),'-');
|
||||
if ($color=='red'||$color=='yellow') {$error3++; $status = ' ['.str_replace(['NP_','_'],['',' '],_var($disk,'status')).']';}
|
||||
$info = _var($disk,'id')." ("._var($disk,'device').")";
|
||||
if ($info==" ()") $info = 'No device identification present';
|
||||
$data[] = my_disk($name)." - $info".my_temp($temp).$fail.$status;
|
||||
return true;
|
||||
}
|
||||
|
||||
// generate report of array devices
|
||||
foreach ($disks as $disk) if ($disk['type']=='Parity') $parity |= my_array($disk);
|
||||
foreach ($disks as $disk) if ($disk['type']=='Data') my_array($disk);
|
||||
foreach ($disks as $disk) if ($disk['type']=='Cache') $cache |= my_array($disk);
|
||||
foreach ($disks as $disk) if (_var($disk,'type')=='Parity') $parity |= my_array($disk);
|
||||
foreach ($disks as $disk) if (_var($disk,'type')=='Data') my_array($disk);
|
||||
foreach ($disks as $disk) if (_var($disk,'type')=='Cache') $pools |= my_array($disk);
|
||||
|
||||
$size = count($data);
|
||||
|
||||
// generate parity report
|
||||
$data[] = "";
|
||||
$mdResync = $var['mdResync'];
|
||||
$data[] = '';
|
||||
$mdResync = _var($var,'mdResync',0);
|
||||
$action = preg_split('/\s+/',_var($var,'mdResyncAction'));
|
||||
if ($mdResync>0) {
|
||||
$mdResyncPos = $var['mdResyncPos'];
|
||||
$mdResyncDb = $var['mdResyncDb'];
|
||||
$mdResyncDt = $var['mdResyncDt'];
|
||||
$mode = '';
|
||||
if (strstr($var['mdResyncAction'],"recon")) {
|
||||
$mode = 'Parity sync / Data rebuild';
|
||||
} elseif (strstr($var['mdResyncAction'],"clear")) {
|
||||
$mode = 'Disk clear';
|
||||
} elseif ($var['mdResyncAction']=="check") {
|
||||
$mode = 'Read check';
|
||||
} elseif (strstr($var['mdResyncAction'],"check")) {
|
||||
$mode = 'Parity check';
|
||||
$mdResyncPos = _var($var,'mdResyncPos',0);
|
||||
$mdResyncDb = _var($var,'mdResyncDb',0);
|
||||
$mdResyncDt = _var($var,'mdResyncDt',0);
|
||||
switch ($action[0]) {
|
||||
case "recon": $mode = $action[1]=='P' ? 'Parity-Sync' : 'Data-Rebuild'; break;
|
||||
case "check": $mode = count($action)>1 ? 'Parity-Check' : 'Read-Check'; break;
|
||||
case "clear": $mode = 'Disk-Clear'; break;
|
||||
default : $mode = 'Unknown'; break;
|
||||
}
|
||||
$data[] = $mode." in progress.";
|
||||
$data[] = "Total size: ".my_scale($mdResync*1024, $unit)." $unit";
|
||||
$data[] = "Elapsed time: ".my_clock(floor((time()-$var['sbUpdated'])/60));
|
||||
$data[] = "Elapsed time: ".my_clock(floor((time()-_var($var,'sbUpdated',0))/60));
|
||||
$data[] = "Current position: ".my_scale($mdResyncPos*1024, $unit)." $unit (".number_format(($mdResyncPos/($mdResync/100+1)),1,$unraid['display']['number'][0],'')." %)";
|
||||
$data[] = "Estimated speed: ".my_scale($mdResyncDb/$mdResyncDt*1024, $unit, 1)." $unit/sec";
|
||||
$data[] = "Estimated finish: ".my_clock(round(((($mdResyncDt*(($mdResync-$mdResyncPos)/($mdResyncDb/100+1)))/100)/60),0));
|
||||
$data[] = "Sync errors ".($var['mdResyncCorr']==0 ? 'detected: ' : 'corrected: ').$var['sbSyncErrs'];
|
||||
$data[] = "Sync errors ".(_var($var,'mdResyncCorr',0)==0 ? 'detected: ' : 'corrected: ')._var($var,'sbSyncErrs',0);
|
||||
} else {
|
||||
$sbSynced = $var['sbSynced'];
|
||||
$sbSynced2 = $var['sbSynced2'];
|
||||
$sbSyncErrs = $var['sbSyncErrs'];
|
||||
if ($var['sbSyncExit']!=0) {
|
||||
$sbSynced = _var($var,'sbSynced',0);
|
||||
$sbSynced2 = _var($var,'sbSynced2',0);
|
||||
$sbSyncErrs = _var($var,'sbSyncErrs',0);
|
||||
if (_var($var,'sbSyncExit',0)!=0) {
|
||||
$data[] = "Last check incomplete on ".my_time($sbSynced2).", finding $sbSyncErrs error".($sbSyncErrs==1?'.':'s.');
|
||||
$data[] = "Error code: ".$var['sbSyncExit'];
|
||||
} elseif ($sbSynced==0) {
|
||||
$data[] = "Parity has not been checked yet";
|
||||
} elseif ($sbSynced2>0) {
|
||||
if (strstr($var['mdResyncAction'],"recon")) {
|
||||
$data[] = 'Parity or Data is invalid';
|
||||
if ($action[0]=='recon') {
|
||||
$data[] = $action[1]=='P' ? 'Parity is invalid' : 'Data-Rebuild is invalid';
|
||||
} else {
|
||||
$data[] = 'Parity is valid';
|
||||
}
|
||||
$duration = $sbSynced2 - $sbSynced;
|
||||
$speed = my_scale($var['mdResyncSize']*1024/$duration,$unit,1)." $unit/s";
|
||||
$duration = Max($sbSynced2-$sbSynced,1);
|
||||
$speed = my_scale(_var($var,'mdResyncSize',0)*1024/$duration,$unit,1)." $unit/s";
|
||||
$data[] = "Last checked on ".my_time($sbSynced2).", finding $sbSyncErrs error".($sbSyncErrs==1?'.':'s.');
|
||||
$data[] = "Duration: ".my_check($duration,$speed);
|
||||
}
|
||||
@@ -181,9 +174,9 @@ if ($mdResync>0) {
|
||||
$word = $size==1 ? "" : "including ";
|
||||
$warn = ($error0 || $error3) ? "alert" : (($error1 || $error2) ? "warning" : "normal");
|
||||
$stat = $warn=="normal" ? "[PASS]" : "[FAIL]";
|
||||
$info = "Array has $size disk".($size==1 ? "" : "s").($parity ? " ({$word}parity".($cache ? " & cache)" : ")") : ($cache ? " ({$word}cache)" : ""));
|
||||
$info = "Array has $size disk".($size==1 ? "" : "s").($parity ? " ({$word}parity".($pools ? " & pools)" : ")") : ($pools ? " ({$word}pools)" : ""));
|
||||
$message = implode('\n', $data);
|
||||
exec("$notify -s ".escapeshellarg("Notice [$server] - array health report $stat")." -d ".escapeshellarg("$info")." -m ".escapeshellarg("$message")." -i ".escapeshellarg("$warn $output")." -l '/Main'");
|
||||
exec("$script -s ".escapeshellarg("Notice [$server] - array health report $stat")." -d ".escapeshellarg("$info")." -m ".escapeshellarg("$message")." -i ".escapeshellarg("$warn $output")." -l '/Main'");
|
||||
|
||||
exit(0);
|
||||
?>
|
||||
|
||||
@@ -19,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = '';
|
||||
$login_locale = $display['locale'];
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
function dmidecode($key, $n, $all=true) {
|
||||
@@ -36,8 +36,8 @@ function dmidecode($key, $n, $all=true) {
|
||||
return $all ? $properties : $properties[0]??null;
|
||||
}
|
||||
|
||||
$var = parse_ini_file('state/var.ini');
|
||||
$model = empty($var['SYS_MODEL']) ? _('N/A') : $var['SYS_MODEL'];
|
||||
$var = @parse_ini_file('state/var.ini') ?: [];
|
||||
$model = _var($var,'SYS_MODEL',_('N/A'));
|
||||
$board = dmidecode('Base Board Information',2,0);
|
||||
$bios = dmidecode('BIOS Information',0,0);
|
||||
$cpu = dmidecode('Processor Information',4,0);
|
||||
@@ -126,7 +126,7 @@ foreach ($memory_array as $device) {
|
||||
[$size, $unit] = my_explode(' ',$device['Maximum Capacity']);
|
||||
$base = array_search($unit,$sizes);
|
||||
if ($base>=1) $memory_maximum += $size*pow(1024,$base);
|
||||
if (!$ecc && isset($device['Error Correction Type']) && $device['Error Correction Type']!='None') $ecc = ($device['Error Correction Type']??'')." ";
|
||||
if (!$ecc && isset($device['Error Correction Type']) && $device['Error Correction Type']!='None') $ecc = $device['Error Correction Type']." ";
|
||||
}
|
||||
if ($memory_installed >= 1024) {
|
||||
$memory_installed = round($memory_installed/1024);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/php -q
|
||||
<?PHP
|
||||
/* Copyright 2005-2022, Lime Technology
|
||||
* Copyright 2012-2022, Bergware International.
|
||||
/* Copyright 2005-2023, Lime Technology
|
||||
* Copyright 2012-2023, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -19,7 +19,7 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
// add translations
|
||||
$_SERVER['REQUEST_URI'] = 'settings';
|
||||
$login_locale = $display['locale'];
|
||||
$login_locale = _var($display,'locale');
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
$file = $argv[1];
|
||||
|
||||
Reference in New Issue
Block a user