From 414dddb008aff63aa4c00cbc5583382cca74decc Mon Sep 17 00:00:00 2001 From: dlandon Date: Sun, 12 May 2024 20:11:31 -0500 Subject: [PATCH] Fix detection of no mountable disks available. --- emhttp/plugins/dynamix/ShareList.page | 17 ++++++++++++++++- emhttp/plugins/dynamix/include/DiskList.php | 16 +++++++++++++++- emhttp/plugins/dynamix/include/ShareList.php | 16 +++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/emhttp/plugins/dynamix/ShareList.page b/emhttp/plugins/dynamix/ShareList.page index 8b33a5b4a..6a580a876 100644 --- a/emhttp/plugins/dynamix/ShareList.page +++ b/emhttp/plugins/dynamix/ShareList.page @@ -16,8 +16,23 @@ Cond="_var($var,'fsState')!='Stopped' && _var($var,'shareUser')=='e'" */ ?> diff --git a/emhttp/plugins/dynamix/include/DiskList.php b/emhttp/plugins/dynamix/include/DiskList.php index eb2b9b683..db0c0b131 100644 --- a/emhttp/plugins/dynamix/include/DiskList.php +++ b/emhttp/plugins/dynamix/include/DiskList.php @@ -30,7 +30,7 @@ $sec_nfs = parse_ini_file('state/sec_nfs.ini',true); // exit when no mountable array disks $nodisks = ""; -if (!$disks) die($nodisks); +if (!checkDisks($disks)) die($nodisks); // No shared disks $nodisks = ""; @@ -38,6 +38,20 @@ $nodisks = ""; -if (!$disks) die($nodisks); +if (!checkDisks($disks)) die($nodisks); // exit when no shares $noshares = ""; @@ -63,6 +63,20 @@ $pools = implode(',', $pools_check); // Natural sorting of share names uksort($shares,'strnatcasecmp'); +// Function to filter out unwanted disks and check if any valid disks exist. +function checkDisks($disks) { + foreach ($disks as $disk) { + // Check the disk type and fsStatus. + if (!in_array($disk['name'], ['flash', 'parity', 'parity2']) && $disk['fsStatus'] !== "Unmountable: unsupported or no file system") { + // A valid disk is found, return true. + return true; + } + } + + // No valid disks found, return false. + return false; +} + // Display export settings function user_share_settings($protocol,$share) { if (empty($share)) return;
"._('There are no mountable array or pool disks - cannot add shares').".
"._('There are no exportable disk shares')."
"._('There are no exportable user shares')."