mirror of
https://github.com/unraid/webgui.git
synced 2026-04-21 09:19:35 -05:00
Added "Update all Plugins" button to plugins page
This commit is contained in:
@@ -227,7 +227,7 @@ function plugin($method, $plugin_file, &$error) {
|
||||
}
|
||||
|
||||
// release notes
|
||||
if ($method == 'changes') {
|
||||
if ($method == "changes") {
|
||||
if (!$xml->CHANGES) return false;
|
||||
return trim($xml->CHANGES);
|
||||
}
|
||||
@@ -374,6 +374,7 @@ $builtin = ['unRAIDServer'];
|
||||
//
|
||||
if ($method == "checkall") {
|
||||
foreach (glob("/var/log/plugins/*", GLOB_NOSORT) as $link) {
|
||||
// skip OS related plugins
|
||||
if (in_array(basename($link,'.plg'),$builtin)) continue;
|
||||
// only consider symlinks
|
||||
$installed_plugin_file = @readlink($link);
|
||||
@@ -386,6 +387,29 @@ if ($method == "checkall") {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// plugin updateall
|
||||
// update all installed plugins, which have a update available
|
||||
//
|
||||
if ($method == "updateall") {
|
||||
foreach (glob("/var/log/plugins/*", GLOB_NOSORT) as $link) {
|
||||
// skip OS related plugins
|
||||
if (in_array(basename($link,'.plg'),$builtin)) continue;
|
||||
// only consider symlinks
|
||||
$installed_plugin_file = @readlink($link);
|
||||
if ($installed_plugin_file === false) continue;
|
||||
if (plugin("pluginURL", $installed_plugin_file, $error) === false) continue;
|
||||
$version = plugin("version", $installed_plugin_file, $error);
|
||||
$plugin = basename($installed_plugin_file);
|
||||
$latest = plugin("version", "/tmp/plugins/$plugin", $error);
|
||||
// update only when newer
|
||||
if (strcmp($latest,$version) > 0) {
|
||||
echo "plugin: updating $plugin ...\n";
|
||||
exec(realpath($argv[0]) . " update $plugin", $output, $retval);
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// plugin checkos
|
||||
// check built-in only
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user