Merge pull request #441 from Squidly271/master

Prevent update notification if plugin is not compatible
This commit is contained in:
tom mortensen
2019-01-17 08:44:40 -08:00
committed by GitHub

View File

@@ -30,8 +30,9 @@ foreach (glob("/tmp/plugins/*.plg", GLOB_NOSORT) as $file) {
if (in_array($name,$builtin)) continue;
$old = plugin('version', "/var/log/plugins/$name.plg");
$new = plugin('version', $file);
$min = plugin('min',$file) ?: $current['version'];
// silently suppress bad download of PLG file
if (strcmp($new, $old) > 0) {
if ( (strcmp($new, $old) > 0) && ! version_compare($min,$current['version'],">") ) {
exec("$notify -e ".escapeshellarg("Plugin - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Version update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
}
}