12-10-2018, 09:05 PM
The old code did not check for an existing mount of the same name before trying to create a new one. This caused a lot of issues.
moOde 4 series added validation for certain fields entered into the NAS config screen and also some simple code to check if the mount already exists. That code is below. It grep's the output of the mount command for the value entire into the Name field.
But since mount points are in the form /mnt/NAS/<Name> the function would always return true if "NAS" were not excluded from <Name>
I'm sure it could be improved on...
moOde 4 series added validation for certain fields entered into the NAS config screen and also some simple code to check if the mount already exists. That code is below. It grep's the output of the mount command for the value entire into the Name field.
Code:
function mountExists($mountname) {
$result = sysCmd('mount | grep -ow ' . '"' . $mountname .'"');
if (!empty($result)) {
return true;
}
else {
return false;
}
}
But since mount points are in the form /mnt/NAS/<Name> the function would always return true if "NAS" were not excluded from <Name>
I'm sure it could be improved on...