mirror of
https://github.com/unraid/webgui.git
synced 2026-01-14 13:39:58 -06:00
119 lines
4.2 KiB
Plaintext
119 lines
4.2 KiB
Plaintext
Menu="About"
|
|
Title="Update OS"
|
|
Icon="icon-update"
|
|
Tag="upload"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2021, Lime Technology
|
|
* Copyright 2012-2021, Bergware International.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
<?
|
|
$version = $branch = $date = _('unknown');
|
|
$bzroot = file_exists('/boot/previous/bzroot');
|
|
$check = $notify['unraidos'] ? 0 : 1;
|
|
|
|
if (file_exists('/boot/previous/changes.txt')) {
|
|
exec("head -n4 /boot/previous/changes.txt",$rows);
|
|
foreach ($rows as $row) {
|
|
$i = stripos($row,'version');
|
|
if ($i !== false) {
|
|
[$version,$date] = explode(' ',trim(substr($row,$i+7)));
|
|
break;
|
|
}
|
|
}
|
|
$branch = strpos($version,'rc')!==false ? _('Next') : (strpos($version,'beta')!==false ? _('Beta') : _('Stable'));
|
|
}
|
|
$reboot = preg_match("/^\*\*(REBOOT REQUIRED|DOWNGRADE)/",@file_get_contents("$docroot/plugins/unRAIDServer/README.md",false,null,0,20));
|
|
?>
|
|
<style>
|
|
input[value="_(Install)_"],input[value="_(Update)_"],input[value="_(Restore)_"]{margin:0}
|
|
<?if ($themes1):?>
|
|
span.vhshift{margin-top:13px!important}
|
|
<?endif;?>
|
|
</style>
|
|
<script>
|
|
var original = null;
|
|
|
|
function update_table(branch) {
|
|
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) {
|
|
updateInfo(data);
|
|
$('#os_table').trigger('update');
|
|
});
|
|
}
|
|
function downgrade() {
|
|
$.get('/plugins/dynamix.plugin.manager/include/Downgrade.php',{version:'<?=$version?>'},function(){refresh();});
|
|
}
|
|
function updateInfo(data) {
|
|
var updates = data.split('\n');
|
|
for (var n=0,update; update=updates[n]; n++) {
|
|
var fields = update.split('\r');
|
|
for (var i=0,field; field=fields[i]; i++) {
|
|
var row = field.split('::');
|
|
$('#'+row[0]).attr('data',row[1]).html(row[2]);
|
|
}
|
|
}
|
|
}
|
|
function initlist() {
|
|
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{init:true,system:true,check:<?=$check?>},function(data) {
|
|
$('#os_list').html(data);
|
|
<?if ($bzroot):?>
|
|
$('#previous').show();
|
|
<?endif;?>
|
|
loadlist();
|
|
});
|
|
}
|
|
function warning (data) {
|
|
$('#change_branch').prop('disabled',true);
|
|
return data.replace('green','orange').replace("<?=_('up-to-date')?>","<?=_('Reboot')?>").replace('check','warning');
|
|
}
|
|
function loadlist(id,check) {
|
|
$.get('/plugins/dynamix.plugin.manager/include/ShowPlugins.php',{system:true,audit:id,check:check||<?=$check?>},function(data) {
|
|
var list = $('#os_list');
|
|
if (id) {
|
|
var cmd = id.split(':');
|
|
var tr = 'tr#'+cmd[0].replace(/[\. _]/g,'');
|
|
switch (cmd[1]) {
|
|
case 'update' : data = warning(data);
|
|
case 'return' : updateInfo(data); break;
|
|
case 'install': list.find(tr).remove(); list.append(warning(data)); break;
|
|
}
|
|
} else {
|
|
<?if (!$reboot):?>
|
|
updateInfo(data);
|
|
<?else:?>
|
|
updateInfo(warning(data));
|
|
<?endif;?>
|
|
}
|
|
$('#os_table').trigger('update');
|
|
$('#checkos').prop('disabled',false);
|
|
<?if ($reboot):?>
|
|
$('#change_branch').prop('disabled',true);
|
|
<?endif;?>
|
|
});
|
|
}
|
|
$(function() {
|
|
initlist();
|
|
$('.tabs').append("<span class='status vhshift'><input type='button' id='checkos' value='<?=_('Check for Updates')?>' onclick='openBox(\"/plugins/dynamix.plugin.manager/scripts/plugin&arg1=checkos\",\"<?=_('System Update Check')?>\",600,600,true,\"loadlist\",\":return\")' disabled></span>");
|
|
});
|
|
</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"><tr><td colspan="6"></td></tr></tbody>
|
|
<?if ($bzroot):?>
|
|
<tbody id="previous" style="display:none"><tr><td><img src="/plugins/unRAIDServer/images/unRAIDServer.png" class="list"></td><td><b>_(Unraid OS)_ (_(previous)_)</b></td><td>LimeTech</td><td><?=$version?></td><td><input type="button" value="_(Restore)_" onclick="downgrade()"></td><td><?=$branch?></td></tbody>
|
|
<?endif;?>
|
|
</table>
|