Merge pull request #330 from bergware/master

OS upgrade enhancements
This commit is contained in:
tom mortensen
2018-04-18 08:53:24 -07:00
committed by GitHub
11 changed files with 213 additions and 114 deletions

View File

@@ -29,9 +29,12 @@ $DockerTemplates = new DockerTemplates();
# ██║ ╚██████╔╝██║ ╚████║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║███████║
# ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
$custom = DockerUtil::docker("network ls --filter driver='macvlan' --format='{{.Name}}'",true);
$custom = DockerUtil::docker("network ls --filter driver='bridge' --filter driver='macvlan' --format='{{.Name}}'|grep -v '^bridge$'",true);
$subnet = ['bridge'=>'', 'host'=>'', 'none'=>''];
$driver = [];
foreach ($custom as $network) $subnet[$network] = substr(DockerUtil::docker("network inspect --format='{{range .IPAM.Config}}{{.Subnet}}, {{end}}' $network"),0,-1);
foreach (DockerUtil::docker("network ls --format='{{.Name}}|{{.Driver}}'",true) as $network) {list($name,$type) = explode('|',$network); $driver[$name] = $type;}
function stopContainer($name) {
global $DockerClient;
@@ -366,8 +369,7 @@ function xmlSecurity(&$template) {
}
function xmlToCommand($xml, $create_paths=false) {
global $var;
global $docroot;
global $docroot, $var, $driver;
$xml = xmlToVar($xml);
$cmdName = strlen($xml['Name']) ? '--name='.escapeshellarg($xml['Name']) : '';
$cmdPrivileged = strtolower($xml['Privileged'])=='true' ? '--privileged=true' : '';
@@ -396,13 +398,18 @@ function xmlToCommand($xml, $create_paths=false) {
@chgrp($hostConfig, 100);
}
} elseif ($confType == 'port') {
// Export ports as variable if Network is set to host
if (preg_match('/^(host|eth[0-9]|br[0-9]|bond[0-9])/',strtolower($xml['Network']))) {
switch ($driver[$xml['Network']]) {
case 'host':
case 'macvlan':
// Export ports as variable if network is set to host or macvlan
$Variables[] = strtoupper(escapeshellarg($Mode.'_PORT_'.$containerConfig).'='.escapeshellarg($hostConfig));
// Export ports as port if Network is set to bridge
} elseif (strtolower($xml['Network'])== 'bridge') {
break;
case 'bridge':
// Export ports as port if network is set to (custom) bridge
$Ports[] = escapeshellarg($hostConfig.':'.$containerConfig.'/'.$Mode);
// No export of ports if Network is set to none
break;
case 'none':
// No export of ports if network is set to none
}
} elseif ($confType == "variable") {
$Variables[] = escapeshellarg($containerConfig).'='.escapeshellarg($hostConfig);

View File

@@ -168,7 +168,7 @@ function updateAll() {
$('input[type=button]').prop('disabled',true);
$('div.spinner').show('slow');
var list = '';
for (var i=0,ct; ct=docker[i]; i++) if (ct.update=='false') list += '&ct[]='+ct.name;
for (var i=0,ct; ct=docker[i]; i++) if (ct.update=='false') list += '&ct[]='+encodeURI(ct.name);
var address = '/plugins/dynamix.docker.manager/include/CreateDocker.php?updateContainer=true'+list;
popupWithIframe('Updating all Containers', address, true, 'loadlist');
}

View File

@@ -17,14 +17,16 @@ Code="f1e6"
* all copies or substantial portions of the Software.
*/
?>
<?
// Remove stale /tmp/plugin/*.plg entries
foreach (glob("/tmp/plugins/*.{plg,txt}", GLOB_NOSORT+GLOB_BRACE) as $entry) if (!file_exists("/var/log/plugins/".basename($entry))) @unlink($entry);
$check = $notify['version'] ? 0 : 1;
?>
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.filetree.css">
<style>#plugin_tree{width:33%;height:200px;overflow-y:scroll}</style>
<style>
#plugin_tree{width:33%;height:200px;overflow-y:scroll}
</style>
<script src="<?autov('/webGui/javascript/jquery.filetree.js')?>"></script>
<script>
<?if ($display['resize']):?>

View File

@@ -15,7 +15,6 @@ Tag="thumbs-up"
*/
?>
<?
$empty = "<tr><td colspan='6'><div class='spinner'></div></td><tr>";
$version = $date = 'unknown';
$bzroot = file_exists('/boot/previous/bzroot');
$check = $notify['unraidos'] ? 0 : 1;
@@ -31,26 +30,46 @@ if (file_exists('/boot/previous/changes.txt')) {
}
}
?>
<style>input[id$='install'],input[id$='update']{margin:0}</style>
<script>
var original = null;
function update_table(branch) {
$('#os_list').html("<?=$empty?>");
if (original) {
if (branch != original) branch = '';
} else {
if (branch) original = branch;
}
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:'true',branch:branch},function(data) {
if (data) $('#os_list').html(data);
$('#os_table').trigger('update',true);
function change_branch(source,branch) {
$('#os_list').html('<tr><td colspan="6"><div class="spinner"></div></td><tr>');
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:true,source:source,branch:branch},function(data) {
$('#os_list').html(data);
});
}
function change_version(current,release,branch) {
if ($('#os-install').length) {
var status = '#os-install';
} else if (release == current) {
var status = null;
$('#os-status').show();
$('#os-upgrade').hide();
$('#os-downgrade').hide();
} else if (release > current) {
var status = '#os-upgrade';
$('#os-status').hide();
$('#os-upgrade').show();
$('#os-downgrade').hide();
} else {
var status = '#os-downgrade';
$('#os-status').hide();
$('#os-upgrade').hide();
$('#os-downgrade').show();
}
if (status !== null) {
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:true,release:release,branch:branch},function(data) {
var link = data.split('\0');
$(status).html($(status).html().replace(link[0],link[1]));
});
}
}
function downgrade() {
$.get('/plugins/dynamix.plugin.manager/include/Downgrade.php',{version:'<?=$version?>'},function(){refresh();});
}
function loadlist(id) {
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:'true',audit:id,check:<?=$check?>},function(data) {
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:true,audit:id,check:<?=$check?>},function(data) {
var list = $('#os_list');
if (id) {
var cmd = id.split(':');
@@ -63,14 +82,22 @@ function loadlist(id) {
} else {
list.html(data);
}
<?if (preg_match("/^\*\*(REBOOT REQUIRED|DOWNGRADE)/",@file_get_contents("$docroot/plugins/unRAIDServer/README.md",false,null,0,20))):?>
$('#change_branch').prop('disabled',true);
<?endif;?>
var reboot = data.search(/REBOOT REQUIRED|DOWNGRADE/)>=0;
if (reboot) {
$('#os-status').html('Changed').show();
$('#change-branch').prop('disabled',true).append($('<option>',{text:'---',selected:true}));
$('#change-version').prop('disabled',true).append($('<option>',{text:'---',selected:true}));
$('#os-install').hide();
$('#os-upgrade').hide();
$('#os-downgrade').hide();
$('#os-release').hide();
$('i.fa-info-circle').hide();
}
<?if ($bzroot):?>
$('#previous').show();
<?endif;?>
<?if ($check):?>
$('#checkos').prop('disabled',false);
$('#checkos').prop('disabled',reboot);
<?endif;?>
});
}
@@ -82,9 +109,6 @@ $(function() {
});
</script>
<table class='tablesorter plugins shift' id='os_table'>
<thead><tr><th></th><th>Component</th><th>Author</th><th>Version</th><th>Status</th><th>Branch</th></tr></thead>
<tbody id="os_list"><?=$empty?></tbody>
<?if ($bzroot):?>
<tbody id="previous" style="display:none"><tr><td><img src="/plugins/unRAIDServer/images/unRAIDServer.png"></td><td><b>unRAID Server OS (previous)</b></td><td>LimeTech</td><td><?=$version?></td><td><?=$date?></td><td><input type="button" value="Downgrade" onclick="downgrade()"></td></tbody>
<?endif;?>
<thead><tr><th></th><th>Component</th><th>Author</th><th>Installed</th><th>Available</th><th>Status</th><th>Branch</th></tr></thead>
<tbody id="os_list"><tr><td colspan="7"><div class="spinner"></div></td><tr></tbody>
</table>

View File

@@ -25,11 +25,11 @@ function check_plugin($arg, $dns='8.8.8.8') {
return exec("ping -qnl2 -c2 -W3 $dns 2>/dev/null|awk '/received/{print $4}'") ? plugin('check',$arg) : false;
}
function make_link($method, $arg, $extra='') {
function make_link($method, $arg, $extra=null, $title=null) {
$plg = basename($arg,'.plg').':'.$method;
$id = str_replace(['.',' ','_'],'',$plg);
$check = $method=='remove' ? "<input type='checkbox' onClick='document.getElementById(\"$id\").disabled=!this.checked'>" : "";
$disabled = $check ? ' disabled' : '';
$disabled = ($check || $extra=='disabled') ? ' disabled' : '';
if ($method == 'delete') {
$cmd = "/plugins/dynamix.plugin.manager/scripts/plugin_rm&arg1=$arg";
$exec = $plg = "";
@@ -37,7 +37,8 @@ function make_link($method, $arg, $extra='') {
$cmd = "/plugins/dynamix.plugin.manager/scripts/plugin&arg1=$method&arg2=$arg".($extra?"&arg3=$extra":"");
$exec = "loadlist";
}
return "$check<input type='button' id='$id' value='".ucfirst($method)."' onclick='openBox(\"$cmd\",\"".ucwords($method)." Plugin\",600,900,true,\"$exec\",\"$plg\");'$disabled>";
$title = $title ?: $method;
return "$check<input type='button' id='$id' value='".ucfirst($title)."' onclick='openBox(\"$cmd\",\"".ucwords($title)." Plugin\",600,900,true,\"$exec\",\"$plg\");'$disabled>";
}
// trying our best to find an icon
@@ -55,6 +56,8 @@ function icon($name) {
if (file_exists($icon)) return $icon;
$icon = "plugins/{$plugin}/{$name}.png";
if (file_exists($icon)) return $icon;
$icon = "plugins/{$name}.png";
if (file_exists($icon)) return $icon;
// last resort - plugin manager icon
return "plugins/dynamix.plugin.manager/images/dynamix.plugin.manager.png";
}

View File

@@ -15,14 +15,18 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
require_once "$docroot/webGui/include/Markdown.php";
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
$system = $_GET['system'] ?? false;
$branch = $_GET['branch'] ?? false;
$audit = $_GET['audit'] ?? false;
$check = $_GET['check'] ?? false;
$empty = true;
$updates = 0;
$builtin = ['unRAIDServer'];
$plugins = "/var/log/plugins/*.plg";
$system = $_GET['system'] ?? false;
$branch = $_GET['branch'] ?? false;
$source = $_GET['source'] ?? false;
$audit = $_GET['audit'] ?? false;
$check = $_GET['check'] ?? false;
$release = $_GET['release'] ?? false;
$empty = true;
$updates = 0;
$missing = "None";
$builtin = "unRAIDServer";
$plugins = $system ? "/var/log/plugins/$builtin.plg" : "/var/log/plugins/*.plg";
$limetech = "https://s3.amazonaws.com/dnld.lime-technology.com";
if ($audit) {
list($plg,$action) = explode(':',$audit);
@@ -34,33 +38,66 @@ if ($audit) {
}
}
function strip($name) {
return str_replace('unRAID ','',$name);
}
function file_date($file) {
//file is considered outdated when older than 1 day
return file_exists($file) ? (filectime($file) > (time()-86400) ? 'up-to-date' : 'outdated') : 'unknown';
}
foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
//only consider symlinks
$plugin_file = @readlink($plugin_link);
if ($plugin_file === false) continue;
//plugin name
$name = plugin('name',$plugin_file) ?: basename($plugin_file,".plg");
$custom = in_array($name,$builtin);
//switch between system and custom plugins
if (($system && !$custom) || (!$system && $custom)) continue;
//forced plugin check?
$checked = (!$audit && !$check) ? check_plugin(basename($plugin_file)) : true;
//OS update?
$os = $system && $name==$builtin[0];
$toggle = false;
//toggle stable/next release?
if ($os && $branch) {
$toggle = plugin('version',$plugin_file);
$tmp_plg = "$name-.plg";
//upgrade or downgrade selected release
if ($release) {
extract(parse_ini_file('/etc/unraid-version'));
$tmp_file = "/var/tmp/$name.plg";
copy($plugin_file,$tmp_file);
exec("sed -ri 's|^(<!ENTITY category).*|\\1 \"{$branch}\">|' $tmp_file");
symlink($tmp_file,"/var/log/plugins/$tmp_plg");
if (check_plugin($tmp_plg)) {
copy("/tmp/plugins/$tmp_plg",$tmp_file);
$plugin_file = $tmp_file;
if ($release != $version) {
exec("sed -ri 's|^(<!ENTITY version).*|\\1 \"$release\">|' $tmp_file");
echo "$plugin_file\0$tmp_file";
} else {
echo "$tmp_file\0$plugin_file";
}
return;
}
//skip system when doing user plugins
if (!$system && strpos($name,$builtin)===0) continue;
//forced plugin check?
$forced = !$audit && !$check;
$checked = $forced ? check_plugin(basename($plugin_file)) : true;
//switch stable/next/test release?
if ($system) {
//current version
extract(parse_ini_file('/etc/unraid-version'));
//category
$category = $branch ?: plugin('category',$plugin_file) ?: (strpos($version,'-')===false ? 'stable' : 'next');
if (!$branch && !$source) $source = $category;
$releases = [];
exec("curl -m 15 $limetech/$category/releases.json 2>/dev/null", $releases);
if ($releases) $releases = json_decode(implode("\n",$releases),true); else $releases[] = ['name' => $missing];
$release = strip($releases[0]['name']);
if ($release != $missing) {
$tmp_plg = "$name-.plg";
$tmp_file = "/var/tmp/$name.plg";
copy($plugin_file,$tmp_file);
if ($branch) exec("sed -ri 's|^(<!ENTITY category).*|\\1 \"$branch\">|' $tmp_file");
symlink($tmp_file,"/var/log/plugins/$tmp_plg");
if ($release != $version && $branch) {
if (check_plugin($tmp_plg)) copy("/tmp/plugins/$tmp_plg", $tmp_file);
exec("sed -ri 's|^(<!ENTITY version).*|\\1 \"$release\">|' $tmp_file");
$plugin_file = $tmp_file;
}
}
} else {
//plugin version
$version = plugin('version',$plugin_file) ?: 'unknown';
}
$save = $version;
//link/icon
$icon = icon($name);
if ($launch = plugin('launch',$plugin_file))
@@ -74,45 +111,51 @@ foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
else
$desc = Markdown("**{$name}**");
//author
$author = plugin('author',$plugin_file) ?: "anonymous";
//version
$version = plugin('version',$plugin_file) ?: "unknown";
$date = str_replace('.','',$version);
//category
$category = plugin('category',$plugin_file) ?: (strpos($version,'-')!==false ? 'next' : 'stable');
$author = plugin('author',$plugin_file) ?: 'anonymous';
//status
$status = 'unknown';
$changes_file = $plugin_file;
$url = plugin('pluginURL',$plugin_file);
if ($url !== false) {
$filename = "/tmp/plugins/".(($os && $branch) ? $tmp_plg : basename($url));
if ($checked && file_exists($filename)) {
if ($toggle && $toggle != $version) {
$status = make_link('install',$plugin_file,'forced');
$extra = $branch && $branch != $source;
$filename = "/tmp/plugins/".(($system && $extra) ? $tmp_plg : basename($url));
$latest = ($checked && file_exists($filename)) ? plugin('version',$filename) : 0;
if ($system) {
$release = strip($releases[0]['name']);
$other = ($release != $missing);
if ($extra) {
if ($other) $version .= "<br><span id='os-release' class='red-text'>$release</span>";
$status = "<span id='os-install'>".make_link('install', $plugin_file,$other?'forced':'disabled')."</span>";
} else {
$latest = plugin('version',$filename);
if ($os ? version_compare($latest,$version,'>') : strcmp($latest,$version) > 0) {
$version .= "<br><span class='red-text'>$latest</span>";
$status = make_link("update",basename($plugin_file));
$style1 = $style2 = "";
if ($forced && $other && $latest===0) $latest = $release;
if (version_compare($latest,$version,'>')) {
$style1 = "style='display:none'";
$version .= "<br><span id='os-release' class='red-text'>$latest</span>";
$changes_file = $filename;
if (!$os) $updates++;
} else {
//status is considered outdated when older than 1 day
$status = filectime($filename) > (time()-86400) ? 'up-to-date' : 'need check';
$style2 = "style='display:none'";
}
$status = "<span id='os-status' $style1>".file_date($filename)."</span>";
$status .= "<span id='os-upgrade' $style2>".make_link('update', basename($plugin_file))."</span>";
$status .= "<span id='os-downgrade' style='display:none'>".make_link('install', $plugin_file, 'forced', 'downgrade')."</span>";
}
} else {
if (strcmp($latest,$version) > 0) {
$version .= "<br><span class='red-text'>$latest</span>";
$status = make_link('update', basename($plugin_file));
$changes_file = $filename;
$updates++;
} else {
$status = file_date($filename);
}
}
}
if (strpos($status,'update')!==false) $rank = '0';
elseif (strpos($status,'install')!==false) $rank = '1';
elseif ($status=='need check') $rank = '2';
elseif ($status=='up-to-date') $rank = '3';
else $rank = '4';
$changes = plugin('changes',$changes_file);
$changes = strpos($version,$missing)===false ? plugin('changes',$changes_file) : false;
if ($changes !== false) {
$txtfile = "/tmp/plugins/".basename($plugin_file,'.plg').".txt";
file_put_contents($txtfile,$changes);
$version .= "&nbsp;<a href='#' title='View Release Notes' onclick=\"openBox('/plugins/dynamix.plugin.manager/include/ShowChanges.php?file=".urlencode($txtfile)."','Release Notes',600,900); return false\"><span class='fa fa-info-circle fa-fw big blue-text'></span></a>";
$version .= "<i class='fa fa-info-circle fa-fw big blue-text' style='cursor:pointer' title='View Release Notes' ";
$version .= "onclick=\"openBox('/plugins/dynamix.plugin.manager/include/ShowChanges.php?file=".urlencode($txtfile)."','Release Notes',600,900)\"></i>";
}
//write plugin information
$empty = false;
@@ -120,24 +163,39 @@ foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
echo "<td style='vertical-align:top;width:64px'><p style='text-align:center'>$link</p></td>";
echo "<td><span class='desc_readmore' style='display:block'>$desc</span></td>";
echo "<td>$author</td>";
echo "<td data='$date'>$version</td>";
echo "<td data='$save'>$version</td>";
if ($system) {
// available releases
$branch = $branch ?: $source;
echo "<td><select id='change-version' class='narrow' onchange='change_version(\"$save\",this.value,\"$branch\")'>";
if ($latest===0)
echo mk_options(0,$missing);
else
foreach ($releases as $release) echo mk_options($version, strip($release['name']));
echo "</select></td>";
$rank = 0;
} else {
if (strpos($status,'upgrade')!==false) $rank = 0;
elseif ($status=='outdated') $rank = 1;
elseif ($status=='up-to-date') $rank = 2;
else $rank = 3;
}
echo "<td data='$rank'>$status</td>";
echo "<td>";
if ($system) {
if ($os) {
echo "<select id='change_branch' class='auto' onchange='update_table(this.value)'>";
echo mk_options($category,'stable');
echo mk_options($category,'next');
echo "</select>";
}
echo "<select id='change-branch' class='auto' onchange='change_branch(\"$source\",this.value)'>";
echo mk_options($category,'stable');
echo mk_options($category,'next');
echo mk_options($category,'test');
echo "</select>";
} else {
echo make_link('remove',basename($plugin_file));
echo make_link('remove', basename($plugin_file));
}
echo "</td>";
echo "</tr>";
//remove temporary symlink
@unlink("/var/log/plugins/$tmp_plg");
if ($tmp_plg) unlink("/var/log/plugins/$tmp_plg");
}
if ($empty) echo "<tr><td colspan='6' style='text-align:center;padding-top:12px'><i class='fa fa-check-square-o icon'></i> No plugins installed</td><tr>";
if ($empty) echo "<tr><td colspan='6' style='text-align:center;padding-top:12px'><i class='fa fa-fw fa-check-square-o'></i> No plugins installed</td><tr>";
echo "\0".$updates;
?>

View File

@@ -110,6 +110,7 @@ function parity_status() {
} else {
echo "<tr><td colspan='2'><span class='red p0'><strong>Data is invalid</strong></span></td></tr>";
}
echo "<tr><td id='parity' colspan='2'></td></tr>";
}
}
function truncate($string,$len) {

View File

@@ -288,6 +288,7 @@ function checkDNSSettings6(form) {
form.DNS6_SERVER1.disabled = disabled;
form.DNS6_SERVER2.disabled = disabled;
form.DNS6_SERVER3.disabled = disabled;
if (!form.DNS6_SERVER1.value && disabled) $('#dns6server1').hide(); else $('#dns6server1').show();
if (!form.DNS6_SERVER2.value && disabled) $('#dns6server2').hide(); else $('#dns6server2').show();
if (!form.DNS6_SERVER3.value && disabled) $('#dns6server3').hide(); else $('#dns6server3').show();
}
@@ -399,6 +400,9 @@ $(function() {
$('#bridge-eth0').dropdownchecklist('disable');
if (form.DNS_SERVER2.value) $('#dnsserver2').show(); else $('#dnsserver2').hide();
if (form.DNS_SERVER3.value) $('#dnsserver3').show(); else $('#dnsserver3').hide();
if (form.DNS6_SERVER1.value) $('#dns6server1').show(); else $('#dns6server1').hide();
if (form.DNS6_SERVER2.value) $('#dns6server2').show(); else $('#dns6server2').hide();
if (form.DNS6_SERVER3.value) $('#dns6server3').show(); else $('#dns6server3').hide();
<?else:?>
checkDNSSettings(form);
checkDNSSettings6(form);
@@ -645,6 +649,7 @@ IPv6 privacy extensions:
> Enable or disable the generation of a random IPv6 interface identifier according to RFC4941. This is similar to the temporary IPv6 address generation on Windows machines.
</div>
<div id="dns6server1" style="display:none" markdown="1">
IPv6 DNS server assignment:
: <select name="DHCP6_KEEPRESOLV" size="1" onchange="checkDNSSettings6(this.form)">
<?=mk_option($eth0['DHCP6_KEEPRESOLV'], "no", "Automatic");?>
@@ -659,6 +664,7 @@ IPv6 DNS server:
> This is the primary IPv6 DNS server to use. Enter a IPv6 address.
</div>
<div id="dns6server2" style="display:none" markdown="1">
IPv6 DNS server 2:
: <input type="text" name="DNS6_SERVER2" maxlength="39" value="<?=$eth0['DNS6_SERVER2'];?>" pattern="<?=$validIP6?>" title="IPv6 address nnnn:xxxx::yyyy">
@@ -675,7 +681,7 @@ IPv6 DNS server 3:
</div>
</div>
Desired MTU:
: <input type="number" name="MTU" min="68" max="9198" value="<?=$eth0['MTU']?>" class="narrow">
: <input type="number" name="MTU" min="68" max="9198" value="<?=$eth0['MTU']?>" class="narrow" placeholder="<?=exec("ip link show dev eth0|grep -Pom1 'mtu \K\d+'")?>">
> This is the MTU size to use on the physical Ethernet interface.
> If left blank, the MTU will automatically be determined (by default 1500 bytes).

View File

@@ -291,7 +291,7 @@ IPv6 privacy extensions:
</div>
</div>
Desired MTU:
: <input type="number" name="MTU" min="68" max="9198" value="<?=$locked?$ethX['MTU']:$ethX['MTU']?>" class="narrow">
: <input type="number" name="MTU" min="68" max="9198" value="<?=$locked?$ethX['MTU']:$ethX['MTU']?>" class="narrow" placeholder="<?=exec("ip link show dev ethX|grep -Pom1 'mtu \K\d+'")?>">
> This is the MTU size to use on the physical Ethernet interface.
> If left blank, the MTU will automatically be determined (by default 1500 bytes).

View File

@@ -297,7 +297,7 @@ case 'port':
break;
case 'parity':
$var = parse_ini_file("state/var.ini");
if ($var['mdNumInvalid']==0 && $var['mdResync']>0) {
if ($var['mdResync']>0) {
$mode = '';
if (strstr($var['mdResyncAction'],"recon")) {
$mode = 'Parity-Sync / Data-Rebuild';
@@ -309,8 +309,8 @@ case 'parity':
$mode = 'Parity-Check';
}
echo "<span class='orange p0'><strong>".$mode." in progress... Completed: ".number_format(($var['mdResyncPos']/($var['mdResync']/100+1)),0)." %.</strong></span>";
echo "<br><em>Elapsed time: ".my_clock(floor((time()-$var['sbUpdated'])/60)).". Estimated finish: ".my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0))."</em>";
} elseif ($var['mdNumInvalid']==0) {
echo "<br><i class='fa fa-clock-o'></i> <em>Elapsed time: ".my_clock(floor((time()-$var['sbUpdated'])/60)).". Estimated finish: ".my_clock(round(((($var['mdResyncDt']*(($var['mdResync']-$var['mdResyncPos'])/($var['mdResyncDb']/100+1)))/100)/60),0))."</em>";
} else {
extract(parse_plugin_cfg('dynamix', true));
list($m,$h) = explode(' ', $parity['hour']);
$time = time();
@@ -378,8 +378,6 @@ case 'parity':
echo "</strong><br><i class='fa fa-clock-o'></i> <em>Due in: ";
echo my_clock(floor($t/60));
echo "</em>";
} else {
echo "<i class='fa fa-warning'></i> Array contains {$var['mdNumInvalid']} invalid disk(s)";
}
break;
case 'shares':

View File

@@ -169,17 +169,12 @@ function showFooter(data, id) {
if (id !== undefined) $('#'+id).remove();
$('#copyright').prepend(data);
}
function showNotice(data,plugin) {
if (plugin)
var href = "href=\"#\" onclick=\"openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2="+plugin+".plg','Update Plugin',600,900,true)\"";
else
var href = "href=\"/Plugins\"";
$('#user-notice').html(data.replace(/<a>(.*)<\/a>/,"<a "+href+">$1</a>"));
function showNotice(data) {
$('#user-notice').html(data.replace(/<a>(.*)<\/a>/,"<a href='/Plugins'>$1</a>"));
}
function showUpgrade(data,plugin) {
var href = "href=\"#\" onclick=\"hideUpgrade();openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2="+plugin+".plg','Update Plugin',600,900,true)\"";
function showUpgrade(data) {
if ($.cookie('os_upgrade')==null)
$('.upgrade_notice').html(data.replace(/<a(.*)>(.*)<\/a>/,"<a "+href+"$1>$2</a>")+"<i class='fa fa-close' title='Close' onclick='hideUpgrade(true)'></i>").show();
$('.upgrade_notice').html(data.replace(/<a>(.*)<\/a>/,"<a href='#' onclick='hideUpgrade();openUpgrade()'>$1</a>")+"<i class='fa fa-close' title='Close' onclick='hideUpgrade(true)'></i>").show();
}
function hideUpgrade(set) {
$('.upgrade_notice').hide();
@@ -188,6 +183,11 @@ function hideUpgrade(set) {
else
$.removeCookie('os_upgrade',{path:'/'});
}
function openUpgrade() {
swal({title:'Update unRAID OS',text:'Do you want to update to the new version?',type:'warning',showCancelButton:true},function(){
openBox('/plugins/dynamix.plugin.manager/scripts/plugin&arg1=update&arg2=unRAIDServer.plg','Update unRAID OS',600,900,true);
});
}
function notifier() {
var tub1 = 0, tub2 = 0, tub3 = 0;
$.post('/webGui/include/Notify.php',{cmd:'get'},function(json) {
@@ -510,7 +510,7 @@ $(function() {
<?elseif (strpos($readme,'DOWNGRADE')!==false):?>
showUpgrade('<b>Reboot required</b> to downgrade unRAID OS');
<?elseif ($version = plugin_update_available('unRAIDServer',true)):?>
showUpgrade('unRAID OS v<?=$version?> is available. <a>Download Now</a>','unRAIDServer');
showUpgrade('unRAID OS v<?=$version?> is available. <a>Update Now</a>');
<?elseif (!$notify['system']):?>
$('.upgrade_notice').html('System notifications are <b>disabled</b>. Click <a href="/Settings/Notifications" style="cursor:pointer">here</a> to change notification settings.').show();
<?endif;?>