mirror of
https://github.com/unraid/webgui.git
synced 2026-02-06 00:49:06 -06:00
Plugin & Docker checks
This commit is contained in:
@@ -12,8 +12,18 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
session_start();
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
|
||||
$unraid = parse_plugin_cfg('dynamix', true);
|
||||
|
||||
// Multi-language support
|
||||
$_SESSION['locale'] = $unraid['display']['locale'];
|
||||
$_SERVER['REQUEST_URI'] = "scripts";
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
exec("pgrep docker", $pid);
|
||||
if (count($pid) == 1) exit(0);
|
||||
|
||||
@@ -52,7 +62,10 @@ if (!isset($check)) {
|
||||
$new = str_replace('sha256:', '', $updateStatus[$image]['remote']);
|
||||
$new = substr($new, 0, 4).'..'.substr($new, -4, 4);
|
||||
if ( ! isset($nonotify) ) {
|
||||
exec("$notify -e ".escapeshellarg("Docker - $name [$new]")." -s ".escapeshellarg("Notice [$server] - Docker update $new")." -d ".escapeshellarg("A new version of $name is available")." -i ".escapeshellarg("normal $output")." -x");
|
||||
$event = str_replace("'","'",_("Docker")." - $name [$new]");
|
||||
$subject = str_replace("'","'",sprintf(_("Notice [%s] - Version update %s"),$server,$new));
|
||||
$description = str_replace("'","'",sprintf(_("A new version of %s is available"),$name));
|
||||
exec("$notify -e ".escapeshellarg($event)." -s ".escapeshellarg($subject)." -d ".escapeshellarg($description)." -i ".escapeshellarg("normal $output")." -x");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,18 +12,22 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
// Multi-language support
|
||||
if (!function_exists('_')) {
|
||||
function _($text) {return $text;}
|
||||
}
|
||||
|
||||
session_start();
|
||||
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
|
||||
|
||||
require_once "$docroot/webGui/include/Wrappers.php";
|
||||
require_once "$docroot/plugins/dynamix.plugin.manager/include/PluginHelpers.php";
|
||||
|
||||
$var = parse_ini_file('/var/local/emhttp/var.ini');
|
||||
$current = parse_ini_file('/etc/unraid-version');
|
||||
$unraid = parse_plugin_cfg('dynamix', true);
|
||||
|
||||
// Multi-language support
|
||||
$_SESSION['locale'] = $unraid['display']['locale'];
|
||||
$_SERVER['REQUEST_URI'] = "scripts";
|
||||
require_once "$docroot/webGui/include/Translations.php";
|
||||
|
||||
|
||||
$current = parse_ini_file('/etc/unraid-version');
|
||||
$server = strtoupper($var['NAME']);
|
||||
$output = $unraid['notify']['plugin'];
|
||||
$builtin = ['unRAIDServer','unRAIDServer-'];
|
||||
@@ -41,7 +45,11 @@ foreach (glob("/$tmp/*.plg", GLOB_NOSORT) as $file) {
|
||||
$min = plugin('min', $file) ?: $current['version'];
|
||||
// silently suppress bad download of PLG file
|
||||
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");
|
||||
// So that "'" doesn't show up in email
|
||||
$event = str_replace("'","'",_("Plugin")." - $name [$new]");
|
||||
$subject = str_replace("'","'",sprintf(_("Notice [%s] - Version update %s"),$server,$new));
|
||||
$description = str_replace("'","'",sprintf(_("A new version of %s is available"),$name));
|
||||
exec("$notify -e ".escapeshellarg($event)." -s ".escapeshellarg($subject)." -d ".escapeshellarg($description)." -i ".escapeshellarg("normal $output")." -x");
|
||||
}
|
||||
}
|
||||
exit(0);
|
||||
|
||||
Reference in New Issue
Block a user