Files
webgui/plugins/dynamix.plugin.manager/scripts/plugincheck
bergware e7032eaff3 Update copyright [6]
2005 it is....
2016-06-14 13:31:56 +02:00

43 lines
1.6 KiB
PHP
Executable File

#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2016, Lime Technology
* Copyright 2015-2016, 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,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
require_once '/usr/local/emhttp/webGui/include/Wrappers.php';
require_once '/usr/local/emhttp/plugins/dynamix.plugin.manager/include/PluginHelpers.php';
exec("wget -qO /dev/null 127.0.0.1:$(lsof -i -P -sTCP:LISTEN|grep -Pom1 '^emhttp.*:\K\d+')/update.htm?cmdStatus=apply");
$current = parse_ini_file('/etc/unraid-version');
$var = parse_ini_file('/var/local/emhttp/var.ini');
$unraid = parse_plugin_cfg('dynamix', true);
$notify = '/usr/local/emhttp/webGui/scripts/notify';
$server = strtoupper($var['NAME']);
$output = $unraid['notify']['plugin'];
plugin("checkall");
foreach (glob("/tmp/plugins/*.plg", GLOB_NOSORT) as $file) {
$plg = basename($file);
$old = plugin('version', "/var/log/plugins/$plg");
$new = plugin('version', $file);
// silently suppress bad download of PLG file
if (strcmp($new, $old) > 0) {
$unRAID = plugin('unRAID', $file);
if ($unRAID === false || version_compare($current['version'], $unRAID, '>=')) {
$name = basename($file, '.plg');
exec("$notify -e 'Plugin - $name [$new]' -s 'Notice [$server] - Version update $new' -d 'A new version of $name is available' -i 'normal $output' -x");
}
}
}
exit(0);
?>