From c666d696797caa893910c1b1576be70ed70ec870 Mon Sep 17 00:00:00 2001 From: Tom Mortensen Date: Thu, 28 Jul 2022 13:10:29 -0700 Subject: [PATCH 1/4] Fix issue installing registration keys --- plugins/dynamix/include/InstallKey.php | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 plugins/dynamix/include/InstallKey.php diff --git a/plugins/dynamix/include/InstallKey.php b/plugins/dynamix/include/InstallKey.php new file mode 100644 index 000000000..4979ce86d --- /dev/null +++ b/plugins/dynamix/include/InstallKey.php @@ -0,0 +1,60 @@ + + _('Please Stop array to complete key installation')), _('success').', '._('Please Stop array to complete key installation')); + } else { + response_complete(200, array('status' => ''), _('success')); + } + } else { + response_complete(406, array('error' => _('download error') . " $return_var")); + } +} else { + response_complete(406, array('error' => _('bad or missing key file') . ": $url")); +} +?> From 860087b9e115f6f2ab02d1d6a8ba1ec1ee1e8bbf Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sat, 30 Jul 2022 15:32:46 +0100 Subject: [PATCH 2/4] Initial Update. --- plugins/dynamix/DeviceCapabilities.page | 7 ++-- plugins/dynamix/include/SmartInfo.php | 46 +++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 6 deletions(-) diff --git a/plugins/dynamix/DeviceCapabilities.page b/plugins/dynamix/DeviceCapabilities.page index 16ded036e..8dda4e2d0 100644 --- a/plugins/dynamix/DeviceCapabilities.page +++ b/plugins/dynamix/DeviceCapabilities.page @@ -18,13 +18,12 @@ Cond="strpos($disks[$name]['status'],'_NP')===false" - - - +
_(Feature)__(Value)__(Information)_
+
diff --git a/plugins/dynamix/include/SmartInfo.php b/plugins/dynamix/include/SmartInfo.php index e95122c07..3885facfa 100644 --- a/plugins/dynamix/include/SmartInfo.php +++ b/plugins/dynamix/include/SmartInfo.php @@ -98,23 +98,65 @@ case "attributes": if ($empty) echo ""._('Can not read attributes').""; break; case "capabilities": + echo ''._('Feature').''._('Value').''._('Information').'' ; exec("smartctl -n standby -c $type ".escapeshellarg("/dev/$port")."|awk 'NR>5'",$output); $row = ['','','']; $empty = true; + if (substr($port,0,4)=="nvme") $nvme=true ; + $nvme_section="info" ; foreach ($output as $line) { - if (!$line) continue; + if (!$line) {echo "" ;continue;} $line = preg_replace('/^_/','__',preg_replace(['/__+/','/_ +_/'],'_',str_replace([chr(9),')','('],'_',$line))); $info = array_map('trim', explode('_', preg_replace('/_( +)_ /','__',$line), 3)); + if ($nvme && $info[0]=="Supported Power States" ) { $nvme_section="psheading" ; continue ;} + if ($nvme && $info[0]=="Supported LBA Sizes" ) { $nvme_section="lbaheading" ; continue ;} append($row[0],$info[0]); append($row[1],$info[1]); append($row[2],$info[2]); - if (substr($row[2],-1)=='.') { + if (substr($row[2],-1)=='.' || ($nvme && $nvme_section=="info")) { echo "${row[0]}${row[1]}${row[2]}"; $row = ['','','']; $empty = false; } + if ($nvme && $nvme_section == "psheading") { + echo '
' ; + $nvme_section = "psdetail"; + preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $psheadings); + for ($i = 1; $i <= 11; $i++) { + echo "".$psheadings['data'.$i]."" ; + } + echo 'Supported Power States' ; + } + if ($nvme && $nvme_section == "psdetail") { + $nvme_section = "psdetail"; + echo '' ; + preg_match('/^(?P.\S+)\s+(?P\S\s+)\s+(?P\S+)\s+(?P\S\s+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $psdetails); + for ($i = 1; $i <= 11; $i++) { + echo "".$psdetails['data'.$i]."" ; + } + echo '' ; + } + if ($nvme && $nvme_section == "lbaheading") { + echo '
' ; + $nvme_section = "lbadetail"; + preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $lbaheadings); + for ($i = 1; $i <= 5; $i++) { + echo "".$lbaheadings['data'.$i]."" ; + } + echo '' ; + } + if ($nvme && $nvme_section == "lbadetail") { + $nvme_section = "lbadetail"; + preg_match('/^(?P.\S+)\s+(?P\S\s+)\s+(?P\S+)\s+(?P\S\s+)\s+(?P\S+)$/',$line, $lbadetails); + echo '' ; + for ($i = 1; $i <= 5; $i++) { + echo "".$lbadetails['data'.$i]."" ; + } + echo '' ; + } } if ($empty) echo ""._('Can not read capabilities').""; + echo "" ; break; case "identify": $passed = ['PASSED','OK']; From 83c8fb36e8c051e060a3781c2a5d4be8f4fe4538 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sat, 30 Jul 2022 15:53:17 +0100 Subject: [PATCH 3/4] Update SmartInfo.php --- plugins/dynamix/include/SmartInfo.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/plugins/dynamix/include/SmartInfo.php b/plugins/dynamix/include/SmartInfo.php index 3885facfa..e062d212f 100644 --- a/plugins/dynamix/include/SmartInfo.php +++ b/plugins/dynamix/include/SmartInfo.php @@ -108,8 +108,6 @@ case "capabilities": if (!$line) {echo "" ;continue;} $line = preg_replace('/^_/','__',preg_replace(['/__+/','/_ +_/'],'_',str_replace([chr(9),')','('],'_',$line))); $info = array_map('trim', explode('_', preg_replace('/_( +)_ /','__',$line), 3)); - if ($nvme && $info[0]=="Supported Power States" ) { $nvme_section="psheading" ; continue ;} - if ($nvme && $info[0]=="Supported LBA Sizes" ) { $nvme_section="lbaheading" ; continue ;} append($row[0],$info[0]); append($row[1],$info[1]); append($row[2],$info[2]); @@ -118,14 +116,22 @@ case "capabilities": $row = ['','','']; $empty = false; } + if ($nvme && $info[0]=="Supported Power States" ) { $nvme_section="psheading" ; $row = ['','',''] ; continue ;} + if ($nvme && $info[0]=="Supported LBA Sizes" ) { + echo "${row[0]}${row[1]}${row[2]}"; + $row = ['','','']; + $nvme_section="lbaheading" ; + continue ; + } if ($nvme && $nvme_section == "psheading") { - echo '
' ; + echo '' ; $nvme_section = "psdetail"; preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $psheadings); for ($i = 1; $i <= 11; $i++) { echo "".$psheadings['data'.$i]."" ; } - echo 'Supported Power States' ; + $row = ['','','']; + echo '' ; } if ($nvme && $nvme_section == "psdetail") { $nvme_section = "psdetail"; @@ -134,15 +140,17 @@ case "capabilities": for ($i = 1; $i <= 11; $i++) { echo "".$psdetails['data'.$i]."" ; } + $row = ['','','']; echo '' ; } if ($nvme && $nvme_section == "lbaheading") { - echo '
' ; + echo '' ; $nvme_section = "lbadetail"; preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $lbaheadings); for ($i = 1; $i <= 5; $i++) { echo "".$lbaheadings['data'.$i]."" ; } + $row = ['','','']; echo '' ; } if ($nvme && $nvme_section == "lbadetail") { @@ -152,6 +160,7 @@ case "capabilities": for ($i = 1; $i <= 5; $i++) { echo "".$lbadetails['data'.$i]."" ; } + $row = ['','','']; echo '' ; } } From c2711478e6e46f371cee4bafda70a56d5aa48fe1 Mon Sep 17 00:00:00 2001 From: SimonFair <39065407+SimonFair@users.noreply.github.com> Date: Sat, 30 Jul 2022 18:00:05 +0100 Subject: [PATCH 4/4] Update to Disk Capabilities pages for NVME drives --- plugins/dynamix/DeviceCapabilities.page | 6 +++--- plugins/dynamix/include/SmartInfo.php | 26 +++++++++++++------------ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/plugins/dynamix/DeviceCapabilities.page b/plugins/dynamix/DeviceCapabilities.page index 8dda4e2d0..5cd3ed599 100644 --- a/plugins/dynamix/DeviceCapabilities.page +++ b/plugins/dynamix/DeviceCapabilities.page @@ -18,13 +18,13 @@ Cond="strpos($disks[$name]['status'],'_NP')===false" - + +
:smart_capabilities_help: diff --git a/plugins/dynamix/include/SmartInfo.php b/plugins/dynamix/include/SmartInfo.php index e062d212f..e857aae42 100644 --- a/plugins/dynamix/include/SmartInfo.php +++ b/plugins/dynamix/include/SmartInfo.php @@ -98,7 +98,7 @@ case "attributes": if ($empty) echo ""._('Can not read attributes').""; break; case "capabilities": - echo ''._('Feature').''._('Value').''._('Information').'' ; + echo '' ; exec("smartctl -n standby -c $type ".escapeshellarg("/dev/$port")."|awk 'NR>5'",$output); $row = ['','','']; $empty = true; @@ -108,30 +108,32 @@ case "capabilities": if (!$line) {echo "" ;continue;} $line = preg_replace('/^_/','__',preg_replace(['/__+/','/_ +_/'],'_',str_replace([chr(9),')','('],'_',$line))); $info = array_map('trim', explode('_', preg_replace('/_( +)_ /','__',$line), 3)); + if ($nvme && $info[0]=="Supported Power States" ) { $nvme_section="psheading" ;echo "
${line}
"; $row = ['','',''] ; continue ;} + if ($nvme && $info[0]=="Supported LBA Sizes" ) { + echo "
${info[0]} ${info[1]} ${info[2]}
"; + $row = ['','','']; + $nvme_section="lbaheading" ; + continue ; + } append($row[0],$info[0]); append($row[1],$info[1]); append($row[2],$info[2]); + if (substr($row[2],-1)=='.' || ($nvme && $nvme_section=="info")) { echo "${row[0]}${row[1]}${row[2]}"; $row = ['','','']; $empty = false; } - if ($nvme && $info[0]=="Supported Power States" ) { $nvme_section="psheading" ; $row = ['','',''] ; continue ;} - if ($nvme && $info[0]=="Supported LBA Sizes" ) { - echo "${row[0]}${row[1]}${row[2]}"; - $row = ['','','']; - $nvme_section="lbaheading" ; - continue ; - } + if ($nvme && $nvme_section == "psheading") { - echo '' ; + echo '' ; $nvme_section = "psdetail"; preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $psheadings); for ($i = 1; $i <= 11; $i++) { echo "" ; } $row = ['','','']; - echo '' ; + echo '' ; } if ($nvme && $nvme_section == "psdetail") { $nvme_section = "psdetail"; @@ -144,7 +146,7 @@ case "capabilities": echo '' ; } if ($nvme && $nvme_section == "lbaheading") { - echo '' ; + echo '' ; $nvme_section = "lbadetail"; preg_match('/^(?P.\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\S+)$/',$line, $lbaheadings); for ($i = 1; $i <= 5; $i++) { @@ -165,7 +167,7 @@ case "capabilities": } } if ($empty) echo ""; - echo "" ; + echo "" ; break; case "identify": $passed = ['PASSED','OK'];