diff --git a/plugins/dynamix/include/DeviceList.php b/plugins/dynamix/include/DeviceList.php
index bfe20b319..8ac0f5f4d 100644
--- a/plugins/dynamix/include/DeviceList.php
+++ b/plugins/dynamix/include/DeviceList.php
@@ -27,7 +27,7 @@ require_once "$docroot/webGui/include/CustomMerge.php";
function in_parity_log($log,$timestamp) {
if (file_exists($log)) {
$handle = fopen($log, 'r');
- while (($line = fgets($handle)) !== false) {
+ while (($line = fgets($handle))!==false) {
if (strpos($line,$timestamp)!==false) break;
}
fclose($handle);
@@ -35,7 +35,7 @@ function in_parity_log($log,$timestamp) {
return !empty($line);
}
function device_info(&$disk,$online) {
- global $path, $var, $show;
+ global $path, $var, $crypto;
$name = $disk['name'];
$fancyname = $disk['type']=='New' ? $name : my_disk($name);
$type = $disk['type']=='Flash' || $disk['type']=='New' ? $disk['type'] : 'Device';
@@ -58,7 +58,7 @@ function device_info(&$disk,$online) {
}
$status = "$ctrl$help";
$link = (strcmp($disk['status'], 'DISK_NP')!=0 || $disk['name']=="cache") ? "".$fancyname."" : $fancyname;
- if ($show && $online) switch ($disk['luksState']) {
+ if ($crypto && $online) switch ($disk['luksState']) {
case 0: $luks = ""; break;
case 1: $luks = "Encrypted and unlocked"; break;
case 2: $luks = "Locked: missing encryption key"; break;
@@ -90,7 +90,7 @@ function assignment(&$disk) {
$out .= "";
} else
$out .= "";
- if ($disk['type']=="Cache")
+ if ($disk['type']=='Cache')
foreach ($devs as $dev) {$out .= "";}
else
foreach ($devs as $dev) if ($dev['tag']==0) {$out .= "";}
@@ -123,22 +123,26 @@ function fs_info(&$disk) {
function my_diskio($data) {
return my_scale($data,$unit,1)." $unit/s";
}
+function parity_only($disk) {
+ return $disk['type']=='Parity';
+}
+function data_only($disk) {
+ return $disk['type']=='Data';
+}
+function cache_only($disk) {
+ return $disk['type']=='Cache';
+}
function array_offline(&$disk) {
global $var, $disks;
- if (strpos($var['mdState'],"ERROR:")===false) {
- $w = 'All existing data on this device will be OVERWRITTEN when array is Started';
- if ($disk['type']=="Cache") {
- if (!empty($disks['cache']['uuid']) && $disk['status']=="DISK_NEW") $warning = $w;
- }
- else {
- if ($var['mdState']=="NEW_ARRAY") {
- if ($disk['type']=="Parity") $warning = $w;
- }
- else {
- if ($disk['status']=="DISK_INVALID" ||
- $disk['status']=="DISK_DSBL_NEW" ||
- $disk['status']=="DISK_WRONG" ||
- $disk['status']=="DISK_NEW") $warning = $w;
+ if (strpos($var['mdState'],'ERROR:')===false) {
+ $text = 'All existing data on this device will be OVERWRITTEN when array is Started';
+ if ($disk['type']=='Cache') {
+ if (!empty($disks['cache']['uuid']) && $disk['status']=='DISK_NEW') $warning = $text;
+ } else {
+ if ($var['mdState']=='NEW_ARRAY') {
+ if ($disk['type']=='Parity') $warning = $text;
+ } else {
+ if (in_array($disk['status'],['DISK_INVALID','DISK_DSBL_NEW','DISK_WRONG','DISK_NEW'])) $warning = $text;
}
}
}
@@ -302,24 +306,26 @@ function cache_slots() {
$out .= "";
return $out;
}
-$show = false;
+$crypto = false;
switch ($_POST['device']) {
case 'array':
- foreach ($disks as $disk) if ($disk['type']=='Data') $show |= strpos($disk['fsType'],'luks:')!==false;
+ $parity = array_filter($disks,'parity_only');
+ $data = array_filter($disks,'data_only');
+ foreach ($data as $disk) $crypto |= strpos($disk['fsType'],'luks:')!==false;
if ($var['fsState']=='Stopped') {
- foreach ($disks as $disk) {if ($disk['type']=='Parity') array_offline($disk);}
+ foreach ($parity as $disk) array_offline($disk);
echo "
Slots:
Slots: