Fixed plugin manager - show correct version for "next" branch

This commit is contained in:
bergware
2020-02-10 05:15:21 +01:00
parent fde7f18085
commit e2d5c56c78
3 changed files with 12 additions and 12 deletions
+3 -3
View File
@@ -4,8 +4,8 @@ Icon="icon-update"
Tag="upload"
---
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -16,7 +16,7 @@ Tag="upload"
*/
?>
<?
$empty = "<tr><td colspan='6'><div class='spinner'></div></td><tr>";
$empty = "<tr><td colspan='6'><div class='spinner'></div></td></tr>";
$version = $branch = $date = 'unknown';
$bzroot = file_exists('/boot/previous/bzroot');
$check = $notify['unraidos'] ? 0 : 1;
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -17,7 +17,7 @@ $docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
function plugin($method, $arg = '') {
global $docroot;
exec("$docroot/plugins/dynamix.plugin.manager/scripts/plugin ".escapeshellarg($method)." ".escapeshellarg($arg), $output, $retval);
return $retval==0 ? implode("\n", $output) : false;
return $retval==0 ? end($output) : false;
}
function check_plugin($arg, &$ncsi) {
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, Bergware International.
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, 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,
@@ -48,16 +48,16 @@ foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
$checked = (!$audit && !$check) ? check_plugin(basename($plugin_file),$ncsi) : true;
//OS update?
$os = $system && $name==$builtin[0];
$toggle = false;
$past = false;
//toggle stable/next release?
if ($os && $branch) {
$toggle = plugin('version',$plugin_file);
$past = plugin('version',$plugin_file);
$tmp_plg = "$name-.plg";
$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,$ncsi)) {
if (version_compare(check_plugin($tmp_plg,$ncsi),$past,'>')) {
copy("/tmp/plugins/$tmp_plg",$tmp_file);
$plugin_file = $tmp_file;
}
@@ -108,7 +108,7 @@ foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
if ($url !== false) {
$filename = "/tmp/plugins/".(($os && $branch) ? $tmp_plg : basename($url));
if ($checked && file_exists($filename)) {
if ($toggle && $toggle != $version) {
if ($past && $past != $version) {
$status = make_link('install',$plugin_file,'forced');
} else {
$latest = plugin('version',$filename);