Use PHP version_compare to check Unraid versions

This commit is contained in:
bergware
2018-09-22 11:05:04 +02:00
parent aed330b7e0
commit 0c9921c66f
@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2017, Lime Technology
* Copyright 2012-2017, Bergware International.
/* Copyright 2005-2018, Lime Technology
* Copyright 2012-2018, 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,
@@ -31,7 +31,7 @@ foreach ($builtin as $name) {
$old = plugin('version', "/var/log/plugins/$plg");
$new = plugin('version', $file);
// silently suppress bad download of PLG file
if (strcmp($new, $old) > 0) {
if (version_compare($new,$old,'>')) {
exec("$notify -e ".escapeshellarg("System - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Version update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
}
}