Merge pull request #1257 from bergware/master

Miscellaneous updates
This commit is contained in:
tom mortensen
2023-02-10 14:57:35 -08:00
committed by GitHub
3 changed files with 24 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ case 'add':
case 'd':
case 'i':
case 'm':
$notify .= " -{$option} \"{$value}\"";
$notify .= " -{$option} ".escapeshellarg($value);
break;
case 'x':
case 't':
@@ -47,11 +47,12 @@ case 'get':
echo shell_exec("$notify get");
break;
case 'hide':
$file = $_POST['file'];
if (file_exists($file) && pathinfo($file)['extension']=='notify') chmod($file,0000);
$file = $_POST['file']??'';
if (file_exists($file) && $file==realpath($file) && pathinfo($file)['extension']=='notify') chmod($file,0000);
break;
case 'archive':
shell_exec("$notify archive ".escapeshellarg($_POST['file']));
$file = $_POST['file']??'';
if (strlen($file) && strpos($file,'/')===false) shell_exec("$notify archive ".escapeshellarg($file));
break;
}
?>

View File

@@ -164,7 +164,7 @@ function fs_info(&$disk) {
function my_diskio($data) {
return my_scale($data,$unit,1)." $unit/s";
}
function array_offline(&$disk,$pool='') {
function array_offline(&$disk, $pool='') {
global $var, $disks;
$echo = []; $warning = '';
if (strpos($var['mdState'],'ERROR:')===false) {
@@ -200,13 +200,25 @@ function array_offline(&$disk,$pool='') {
$echo[] = "<td>".device_info($disk,false)."</td>";
$echo[] = "<td>".assignment($disk)."</td>";
$echo[] = "<td>".my_temp($disk['temp'])."</td>";
$echo[] = "<td colspan='7'>$warning</td>";
if ($warning) {
$echo[] = "<td colspan='7'>$warning</td>";
} else {
$echo[] = "<td colspan='3'></td>";
$echo[] = "<td>".vfs_type($disk['fsType']??'')."</td>";
$echo[] = "<td colspan='3'></td>";
}
break;
case 'DISK_WRONG':
$echo[] = "<td>".device_info($disk,false)."<br><span class='diskinfo'><em>"._('Wrong')."</em></span></td>";
$echo[] = "<td>".assignment($disk)."<em>{$disk['idSb']} - ".my_scale($disk['sizeSb']*1024,$unit)." $unit</em></td>";
$echo[] = "<td>".my_temp($disk['temp'])."</td>";
$echo[] = "<td colspan='7'>$warning</td>";
if ($warning) {
$echo[] = "<td colspan='7'>$warning</td>";
} else {
$echo[] = "<td colspan='3'></td>";
$echo[] = "<td>".vfs_type($disk['fsType']??'')."</td>";
$echo[] = "<td colspan='3'></td>";
}
break;
}
$echo[] = "</tr>";
@@ -236,9 +248,9 @@ function array_online(&$disk, $fstype='') {
$echo[] = "<tr>";
switch ($disk['status']) {
case 'DISK_NP':
if (in_array($disk['name'],$pools) || $fstype = 'zfs') {
if (in_array($disk['name'],$pools) || $fstype=='zfs') {
$echo[] = "<td>".device_info($disk,true)."</td>";
$echo[] = "<td><a class='static'><i class='icon-disk icon'></i><span></span></a><em>".($fstype ? _('Not present') : _('Not installed'))."</em></td>";
$echo[] = "<td><a class='static'><i class='icon-disk icon'></i><span></span></a><em>".($fstype=='zfs' ? _('Not present') : _('Not installed'))."</em></td>";
$echo[] = "<td colspan='4'></td>";
$echo[] = fs_info($disk);
}
@@ -436,7 +448,7 @@ while (true) {
$echo[$n] .= "<tr class='tr_last'><td>"._('Slots').":</td><td colspan='8'>".cache_slots($off,$pool,$cache[$pool]['devicesSb'],$cache[$pool]['slots'])."</td><td></td></tr>";
} else {
foreach ($cache as $disk) if (prefix($disk['name'])==$pool) {
if (empty($fstype) && isset($disk['fsType'])) $fstype = str_replace('luks:','',$disk['fsType']);
if (isset($disk['fsType'])) $fstype = vfs_type($disk['fsType']);
if (substr($cache[$pool]['fsStatus'],0,11)=='Unmountable' && empty($disk['fsStatus'])) $disk['fsStatus'] = $cache[$pool]['fsStatus'];
$echo[$n] .= array_online($disk,$fstype);
}

View File

@@ -204,7 +204,7 @@ function device_smart(&$disk, &$fail, &$smart) {
function device_usage(&$disk, &$full, &$high) {
global $display;
$text = $display['text'];
$used = ($disk['type']!='Parity' && $disk['type']!='Extra' && isset($disk['fsStatus']) && $disk['fsStatus']=='Mounted') ? ((isset($disk['fsSize']) ? round((1-$disk['fsFree']/$disk['fsSize'])*100):0).'%') : false;
$used = ($disk['type']!='Parity' && $disk['type']!='Extra' && isset($disk['fsStatus']) && $disk['fsStatus']=='Mounted') ? (((isset($disk['fsSize']) && $disk['fsSize']>0) ? round((1-$disk['fsFree']/$disk['fsSize'])*100):0).'%') : false;
if ($used) {
if ($text==2 || $text==21) {
$load = substr($used,0,-1);