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

This commit is contained in:
bergware
2020-02-12 08:23:26 +01:00
parent 2abc07403d
commit 7439317937
2 changed files with 3 additions and 2 deletions
@@ -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 ? end($output) : false;
return $retval==0 ? implode("\n", $output) : false;
}
function check_plugin($arg, &$ncsi) {
@@ -57,7 +57,8 @@ foreach (glob($plugins,GLOB_NOSORT) as $plugin_link) {
copy($plugin_file,$tmp_file);
exec("sed -ri 's|^(<!ENTITY category).*|\\1 \"{$branch}\">|' $tmp_file");
symlink($tmp_file,"/var/log/plugins/$tmp_plg");
if (version_compare(check_plugin($tmp_plg,$ncsi),$past,'>')) {
$next = end(explode("\n",check_plugin($tmp_plg,$ncsi)));
if (version_compare($next,$past,'>')) {
copy("/tmp/plugins/$tmp_plg",$tmp_file);
$plugin_file = $tmp_file;
}