diff --git a/emhttp/plugins/dynamix/ShareEdit.page b/emhttp/plugins/dynamix/ShareEdit.page index 093ad9ff6..b94dcb671 100644 --- a/emhttp/plugins/dynamix/ShareEdit.page +++ b/emhttp/plugins/dynamix/ShareEdit.page @@ -15,6 +15,10 @@ Tag="share-alt-square" */ ?> +if (!empty($name) && !array_key_exists($name, $shares)) { + echo ""; + return; +} $width = [123,300]; if ($name == "") { @@ -33,13 +37,9 @@ if ($name == "") { "cachePool2" => "", "cow" => "auto" ]; -} elseif (array_key_exists($name, $shares)) { +} else { /* edit existing share. */ $share = $shares[$name]; -} else { - /* handle share deleted case. */ - echo "
"._('Share')." '".htmlspecialchars($name)."' "._('has been deleted').".
"; - return; } /* If the configuration is pools only, then no array disks are available. */ @@ -56,23 +56,26 @@ if ((! $share['cachePool']) && ($share['cachePool2'])) { $share['cachePool2'] = ""; } +/* Correct a situation in previous Unraid versions where an array only share has a useCache defined. */ +if ((!$poolsOnly) && ($share['useCache'] == "no")) { + $share['cachePool'] = ""; +} + /* Check for non existent pool device. */ -if ($share['cachePool'] && !in_array($share['cachePool'], $pools)) { - $poolDefined = false; +if (($share['cachePool'] && !in_array($share['cachePool'], $pools))) { $share['useCache'] = $share['cachePool2'] ? "yes" : ($poolsOnly ? "no" : "yes"); + $poolDefined = false; } else { $share['useCache'] = $share['useCache'] ?: ($poolsOnly ? "only" : "no"); $poolDefined = true; } /* Check for pool 2 (or array) being defined. */ +$poolDefined2 = true; if ((($share['useCache'] == "yes") || ($share['useCache'] == "prefer")) && ($poolsOnly) && (!$share['cachePool2'])) { - $poolDefined2 = true; $share['useCache'] = "only"; } else if ($share['cachePool2']) { $poolDefined2 = in_array($share['cachePool2'], $pools); -} else { - $poolDefined2 = true; } $cachePoolCapitalized = compress(my_disk($share['cachePool'],$display['raw'])); @@ -457,7 +460,7 @@ _(Excluded disk(s))_: -