Merge pull request #1081 from bergware/master

Fixed: specific disk settings for pool devices only
This commit is contained in:
tom mortensen
2022-04-23 07:45:35 -07:00
committed by GitHub
2 changed files with 9 additions and 8 deletions

View File

@@ -448,6 +448,7 @@ _(File system type)_:
</select>
<?endif;?>
<?if (in_array($name,$pools)):?>
<?$disabled = $var['fsState']!="Stopped" ? "disabled" : ""?>
_(Enable user share assignment)_:
: <select id="shareEnabled" name="diskShareEnabled.<?=$disk['idx']?>" onchange="freeSpace(this.value)" <?=$disabled?>>
@@ -462,6 +463,7 @@ _(Minimum free space)_:
:info_free_space_help:
<?endif;?>
_(Warning disk utilization threshold)_ (%):
: <input type="number" min="0" max="100" name="diskWarning.<?=$disk['idx']?>" class="narrow" value="<?=strlen($disk['warning'])?$disk['warning']:''?>" placeholder="<?=$display['warning']?>">

View File

@@ -38,9 +38,6 @@ function find_tasks() {
sort($tasks);
return $tasks;
}
function plain($ip) {
return str_replace(['[',']'],'',$ip);
}
$tasks = find_tasks();
$ethX = 'eth0';
$addr = ipaddr($ethX);
@@ -85,13 +82,15 @@ $upgradelabel = _('Upgrade Cert');
$portsInUse = [];
exec("lsof -Pni|awk '/LISTEN/ && \$9!~/127.0.0.1/ && \$9!~/\\[::1\\]/{print \$9}'|sort -u", $output);
$bind = $var['BIND_MGT']=='yes';
$bind = false; //= $var['BIND_MGT']=='yes'; - not used in 6.10
$list = ['*',$addr];
foreach ($output as $line) {
[$ip, $port] = my_explode(':', $line);
if (!in_array($port,$portsInUse) && (!$bind || in_array(plain($ip),$list))) $portsInUse[] = $port;
[$ip, $port] = my_explode($line[0]=='[' ? ']:' : ':',$line);
if ($ip[0]=='[') $ip = substr($ip,1); // ipv6 address
if (!in_array($port,$portsInUse) && (!$bind || in_array($ip,$list))) $portsInUse[] = $port;
}
sort($portsInUse,SORT_NUMERIC);
?>
<script>
function provisionHandler(event, form) { // provisions and renewals require being Signed In to Unraid.net
@@ -117,7 +116,7 @@ function updateDNS(button) {
}
function checkPorts(form) {
var portsInUse = JSON.parse('<?=json_encode($portsInUse)?>');
var portsInUse = [<?=implode(',',$portsInUse)?>];
var range = [], list = [], duplicates = [];
var checks = [
{'key':"PORTTELNET", 'used':"<?=$var['USE_TELNET']=='yes'?>", 'port':"<?=$var['PORTTELNET']?>", 'default':"23" , 'name':"_(TELNET port)_"},
@@ -134,7 +133,7 @@ function checkPorts(form) {
if (userPort < 1 || userPort > 65535) range.push(userPort+' ('+check['name']+')');
duplicates.push(userPort);
if (check['used'] == '1' && userPort != current) {
if (portsInUse.includes(userPort)) list.push(userPort+' ('+check['name']+')');
if (portsInUse.includes(parseInt(userPort))) list.push(userPort+' ('+check['name']+')');
}
}
duplicates = duplicates.reduce(function(acc, el, i, arr) {