mirror of
https://github.com/unraid/webgui.git
synced 2026-01-04 08:29:51 -06:00
fix: if singled disabled array disk, should still be able to create shares
This commit is contained in:
@@ -16,23 +16,16 @@ Cond="_var($var,'fsState')!='Stopped' && _var($var,'shareUser')=='e'"
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
/* Function to filter out unwanted disks, check if any valid disks exist, and ignore disks with a blank device. */
|
||||
function checkDisks($disks) {
|
||||
global $pools;
|
||||
|
||||
$rc = false;
|
||||
|
||||
foreach ($disks as $disk) {
|
||||
/* Check the disk type, fsStatus, and ensure the device is not blank. */
|
||||
if (!in_array($disk['name'], ['flash', 'parity', 'parity2']) && strpos($disk['fsStatus'], 'Unmountable') === false && !empty($disk['device'])) {
|
||||
/* A valid disk with a non-blank device is found. */
|
||||
$rc = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $rc;
|
||||
/* Function to test if any Mouned volumes exist. */
|
||||
function checkDisks(&$disks) {
|
||||
$rc = false;
|
||||
foreach ($disks as $disk) {
|
||||
if ($disk['name']!=='flash' && _var($disk,'fsStatus',"")==='Mounted') {
|
||||
$rc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $rc;
|
||||
}
|
||||
|
||||
/* Are there any array disks? */
|
||||
|
||||
@@ -36,7 +36,7 @@ $pools = implode(',', $pools_check);
|
||||
$poolsOnly = ((int)$var['SYS_ARRAY_SLOTS'] <= 2) ? true : false;
|
||||
|
||||
// exit when no mountable array disks
|
||||
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mountable array or pool disks - cannot add shares').".</strong></td></tr>";
|
||||
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mounted array or pool disks - cannot add shares').".</strong></td></tr>";
|
||||
if (!checkDisks($disks)) die($nodisks);
|
||||
|
||||
// No shared disks
|
||||
@@ -45,23 +45,18 @@ $nodisks = "<tr><td class='empty' colspan='7'><i class='fa fa-folder-open-o icon
|
||||
// GUI settings
|
||||
extract(parse_plugin_cfg('dynamix',true));
|
||||
|
||||
/* Function to filter out unwanted disks, check if any valid disks exist, and ignore disks with a blank device. */
|
||||
function checkDisks($disks) {
|
||||
global $pools, $poolsOnly;
|
||||
/* Function to test if any Mouned volumes exist. */
|
||||
function checkDisks(&$disks) {
|
||||
$rc = false;
|
||||
|
||||
$rc = false;
|
||||
foreach ($disks as $disk) {
|
||||
if ($disk['name']!=='flash' && _var($disk,'fsStatus',"")==='Mounted') {
|
||||
$rc = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($disks as $disk) {
|
||||
/* Check the disk type, fsStatus, and ensure the device is not blank. */
|
||||
if (!in_array($disk['name'], ['flash', 'parity', 'parity2']) && strpos($disk['fsStatus'], 'Unmountable') === false && !empty($disk['device'])) {
|
||||
/* A valid disk with a non-blank device is found. */
|
||||
$rc = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $rc;
|
||||
return $rc;
|
||||
}
|
||||
|
||||
// Display export settings
|
||||
|
||||
@@ -115,7 +115,7 @@ $pools_check = pools_filter(cache_filter($disks));
|
||||
$pools = implode(',', $pools_check);
|
||||
|
||||
// exit when no mountable array disks
|
||||
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mountable array or pool disks - cannot add shares').".</strong></td></tr>";
|
||||
$nodisks = "<tr><td class='empty' colspan='7'><strong>"._('There are no mounted array or pool disks - cannot add shares').".</strong></td></tr>";
|
||||
if (!checkDisks($disks)) die($nodisks);
|
||||
|
||||
// exit when no shares
|
||||
@@ -128,18 +128,13 @@ extract(parse_plugin_cfg('dynamix',true));
|
||||
// Natural sorting of share names
|
||||
uksort($shares,'strnatcasecmp');
|
||||
|
||||
/* Function to filter out unwanted disks, check if any valid disks exist, and ignore disks with a blank device. */
|
||||
function checkDisks($disks) {
|
||||
global $pools;
|
||||
|
||||
/* Function to test if any Mouned volumes exist. */
|
||||
function checkDisks(&$disks) {
|
||||
$rc = false;
|
||||
|
||||
foreach ($disks as $disk) {
|
||||
/* Check the disk type, fsStatus, and ensure the device is not blank. */
|
||||
if (!in_array($disk['name'], ['flash', 'parity', 'parity2']) && strpos($disk['fsStatus'], 'Unmountable') === false && !empty($disk['device'])) {
|
||||
/* A valid disk with a non-blank device is found. */
|
||||
if ($disk['name']!=='flash' && _var($disk,'fsStatus',"")==='Mounted') {
|
||||
$rc = true;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user