@@ -19,3 +19,11 @@ export TMP_PATH="${SCRIPT_PATH}/tmp"
|
|||||||
# Options
|
# Options
|
||||||
export VERBOSE="1"
|
export VERBOSE="1"
|
||||||
|
|
||||||
|
# Command to execute for every outdated installation. This will be called with the following parameters:
|
||||||
|
# - package
|
||||||
|
# - expected version
|
||||||
|
# - found version
|
||||||
|
# - path
|
||||||
|
# Example: /usr/local/bin/notify-outdated.sh wordpress 3.7.1 3.6.0 localhost:/home/user/public_html/
|
||||||
|
#export NOTIFY_SCRIPT="/usr/local/bin/notify-outdated.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ function checkHost($host, $cake_current) {
|
|||||||
$version = $parts[1];
|
$version = $parts[1];
|
||||||
if($version < $cake_current) {
|
if($version < $cake_current) {
|
||||||
verbose("WARNING: Outdated CakePHP $version at $hostidentifier$location", 0);
|
verbose("WARNING: Outdated CakePHP $version at $hostidentifier$location", 0);
|
||||||
|
notifyScript("CakePHP", $cake_current, $version, "$hostidentifier$location");
|
||||||
} else {
|
} else {
|
||||||
verbose("Recent CakePHP $version at $hostidentifier$location", 2);
|
verbose("Recent CakePHP $version at $hostidentifier$location", 2);
|
||||||
}
|
}
|
||||||
|
|||||||
12
run.d/drupal
12
run.d/drupal
@@ -48,7 +48,12 @@ function checkHost($host, $dr_current) {
|
|||||||
$location = substr($parts[0], 0, strlen($parts[0])-28);
|
$location = substr($parts[0], 0, strlen($parts[0])-28);
|
||||||
if(substr($parts[1], 0, 16) == "define('VERSION'") {
|
if(substr($parts[1], 0, 16) == "define('VERSION'") {
|
||||||
$version = substr($parts[1], 19, strpos($parts[1], "'", 19)-19);
|
$version = substr($parts[1], 19, strpos($parts[1], "'", 19)-19);
|
||||||
if($version < $dr_current) echo "WARNING: Outdated Drupal $version at $hostidentifier$location\n";
|
if($version < $dr_current) {
|
||||||
|
verbose("WARNING: Outdated Drupal $version at $hostidentifier$location", 0);
|
||||||
|
notifyScript("Drupal", $dr_current, $version, "$hostidentifier$location");
|
||||||
|
}else {
|
||||||
|
verbose("Recent Drupal $version at $host$location", 2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unset($results);
|
unset($results);
|
||||||
@@ -66,9 +71,10 @@ function checkHost($host, $dr_current) {
|
|||||||
if(substr($parts[1], 0, 16) == "define('VERSION'") {
|
if(substr($parts[1], 0, 16) == "define('VERSION'") {
|
||||||
$version = substr($parts[1], 19, strpos($parts[1], "'", 19)-19);
|
$version = substr($parts[1], 19, strpos($parts[1], "'", 19)-19);
|
||||||
if($version < $dr_current) {
|
if($version < $dr_current) {
|
||||||
verbose("WARNING: Outdated Drupal $version at $host:$location", 0);
|
verbose("WARNING: Outdated Drupal $version at $host$location", 0);
|
||||||
|
notifyScript("Drupal", $dr_current, $version, "$hostidentifier$location");
|
||||||
} else {
|
} else {
|
||||||
verbose("Recent Drupal $version at $host:$location", 2);
|
verbose("Recent Drupal $version at $host$location", 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,15 @@ function checkHost($host, $mw_current) {
|
|||||||
$version_major = $version_parts[0] . "." . $version_parts[1];
|
$version_major = $version_parts[0] . "." . $version_parts[1];
|
||||||
if( !array_key_exists($version_major, $mw_current) || $version < $mw_current[$version_major] ) {
|
if( !array_key_exists($version_major, $mw_current) || $version < $mw_current[$version_major] ) {
|
||||||
verbose("WARNING: Outdated MediaWiki $version at $hostidentifier$location", 0);
|
verbose("WARNING: Outdated MediaWiki $version at $hostidentifier$location", 0);
|
||||||
|
if( array_key_exists($version_major, $mw_current) ) {
|
||||||
|
notifyScript("MediaWiki", $mw_current[$version_major], $version, "$hostidentifier$location");
|
||||||
|
}else {
|
||||||
|
$maxVersion = "0.0";
|
||||||
|
foreach( array_keys($mw_current) as $mw_version ) {
|
||||||
|
if( $maxVersion < $mw_version ) $maxVersion = $mw_version;
|
||||||
|
}
|
||||||
|
notifyScript("MediaWiki", $maxVersion, $version, "$hostidentifier$location");
|
||||||
|
}
|
||||||
}else {
|
}else {
|
||||||
verbose("Recent MediaWiki $version at $hostidentifier$location", 2);
|
verbose("Recent MediaWiki $version at $hostidentifier$location", 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ function checkHost($host, $mg_current) {
|
|||||||
|
|
||||||
if( !array_key_exists($version_major, $mg_current) || $version < $mg_current[$version_major] ) {
|
if( !array_key_exists($version_major, $mg_current) || $version < $mg_current[$version_major] ) {
|
||||||
verbose("WARNING: Outdated Menalto Gallery $version at $hostidentifier$location", 0);
|
verbose("WARNING: Outdated Menalto Gallery $version at $hostidentifier$location", 0);
|
||||||
|
notifyScript("Menalto Gallery", $mg_current, $version, "$hostidentifier$location");
|
||||||
}else {
|
}else {
|
||||||
verbose("Recent Menalto Gallery $version at $hostidentifier$location", 2);
|
verbose("Recent Menalto Gallery $version at $hostidentifier$location", 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ function checkHost($host, $pma_current) {
|
|||||||
$version = $matches[1];
|
$version = $matches[1];
|
||||||
if($version < $pma_current) {
|
if($version < $pma_current) {
|
||||||
verbose("WARNING: Outdated PHPMyAdmin $version at $hostidentifier$location", 0);
|
verbose("WARNING: Outdated PHPMyAdmin $version at $hostidentifier$location", 0);
|
||||||
|
notifyScript("PHPMyAdmin", $pma_current, $version, "$hostidentifier$location");
|
||||||
} else {
|
} else {
|
||||||
verbose("Recent PHPMyAdmin $version at $hostidentifier$location", 2);
|
verbose("Recent PHPMyAdmin $version at $hostidentifier$location", 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,4 +23,17 @@ function verbose($msg, $loglevel=0) {
|
|||||||
if($loglevel <= $verbose) echo $msg."\n";
|
if($loglevel <= $verbose) echo $msg."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notify script
|
||||||
|
//
|
||||||
|
function notifyScript($tool, $expectedVersion, $foundVersion, $path) {
|
||||||
|
if( getenv('NOTIFY_SCRIPT') != null ) {
|
||||||
|
$cmd = getenv('NOTIFY_SCRIPT') . " " .
|
||||||
|
escapeshellarg($tool) . " " .
|
||||||
|
escapeshellarg($expectedVersion) . " " .
|
||||||
|
escapeshellarg($foundVersion) . " " .
|
||||||
|
escapeshellarg($path);
|
||||||
|
exec($cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ function checkHost($host, $wp_current) {
|
|||||||
$version = $matches[1];
|
$version = $matches[1];
|
||||||
if($version < $wp_current) {
|
if($version < $wp_current) {
|
||||||
verbose("WARNING: Outdated Wordpress $version at $hostidentifier$location", 0);
|
verbose("WARNING: Outdated Wordpress $version at $hostidentifier$location", 0);
|
||||||
|
notifyScript("Wordpress", $wp_current, $version, "$hostidentifier$location");
|
||||||
} else {
|
} else {
|
||||||
verbose("Recent Wordpress $version at $hostidentifier$location", 2);
|
verbose("Recent Wordpress $version at $hostidentifier$location", 2);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user