add scripts for CakePHP and PHPMyAdmin, courtesy of WvR.
Also include new logging options (verbosity)
This commit is contained in:
@@ -13,3 +13,6 @@ export CHK_HOSTS="host1 host2 host3"
|
|||||||
export RUN_PATH="${SCRIPT_PATH}/run.d"
|
export RUN_PATH="${SCRIPT_PATH}/run.d"
|
||||||
export TMP_PATH="${SCRIPT_PATH}/tmp"
|
export TMP_PATH="${SCRIPT_PATH}/tmp"
|
||||||
|
|
||||||
|
# Options
|
||||||
|
export VERBOSE="1"
|
||||||
|
|
||||||
|
|||||||
39
run.d/cakephp
Normal file
39
run.d/cakephp
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
#!/usr/bin/php -q
|
||||||
|
<?
|
||||||
|
require_once("toolkit.php");
|
||||||
|
|
||||||
|
$cake_api = file_get_contents("https://github.com/cakephp/cakephp/tags");
|
||||||
|
if( preg_match("/\<span class=\"tag\-name\"\>([0-9\.]+)\<\/span\>/", $cake_api, $matches) ) {
|
||||||
|
$cake_current = $matches[1];
|
||||||
|
verbose(Current CakePHP version: $cake_current", 1);
|
||||||
|
}else {
|
||||||
|
die("Unable to determine current CakePHP version, exiting\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
checkHost(null, $cake_current);
|
||||||
|
if( $hosts != null ) {
|
||||||
|
foreach($hosts as $host) {
|
||||||
|
checkHost($host, $cake_current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkHost($host, $cake_current) {
|
||||||
|
$cmd = "locate -i Cake/VERSION.txt | xargs grep -H -v \"//\" | grep -v \"ake/VERSION.txt:$\"";
|
||||||
|
$hostidentifier = "localhost:";
|
||||||
|
if( $host != null ) {
|
||||||
|
$cmd = "ssh $host \"" . $cmd . "\"";
|
||||||
|
$hostidentifier = $host . ":";
|
||||||
|
}
|
||||||
|
exec($cmd, $results);
|
||||||
|
foreach($results as $instance) {
|
||||||
|
$parts = explode(':', $instance);
|
||||||
|
$location = substr($parts[0], 0, strlen($parts[0])-16);
|
||||||
|
$version = $parts[1];
|
||||||
|
if($version < $cake_current) {
|
||||||
|
echo "WARNING: Outdated CakePHP $version at $hostidentifier$location\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($results);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
11
run.d/drupal
11
run.d/drupal
@@ -1,13 +1,6 @@
|
|||||||
#!/usr/bin/php -q
|
#!/usr/bin/php -q
|
||||||
<?
|
<?
|
||||||
// Fetch the host list to check
|
require_once("toolkit.php");
|
||||||
//
|
|
||||||
if(getenv('CHK_HOSTS') == null) {
|
|
||||||
$hosts = null;
|
|
||||||
} else {
|
|
||||||
$hosts = explode(' ', getenv('CHK_HOSTS'));
|
|
||||||
if (implode($hosts)=='') die("No hosts to check.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve current Drupal version as documented at http://www.goldcoastmedia.co.uk/blog/drupal-versions-with-php
|
// Retrieve current Drupal version as documented at http://www.goldcoastmedia.co.uk/blog/drupal-versions-with-php
|
||||||
//
|
//
|
||||||
@@ -30,6 +23,8 @@ if($feed && $feed instanceof SimpleXMLElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verbose("Current Drupal version: $dr_current", 1);
|
||||||
|
|
||||||
// Start checking hosts
|
// Start checking hosts
|
||||||
//
|
//
|
||||||
checkHost(null, $dr_current);
|
checkHost(null, $dr_current);
|
||||||
|
|||||||
40
run.d/phpmyadmin
Executable file
40
run.d/phpmyadmin
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/usr/bin/php -q
|
||||||
|
<?
|
||||||
|
require_once("toolkit.php");
|
||||||
|
|
||||||
|
$pma_api = file_get_contents("http://www.phpmyadmin.net/home_page/downloads.php");
|
||||||
|
if( preg_match("/>phpMyAdmin\-([0-9\.]+)\-all\-languages\.tar\.gz</", $pma_api, $matches) ) {
|
||||||
|
$pma_current = $matches[1];
|
||||||
|
verbose("Current PHPMyAdmin version: $pma_current", 1);
|
||||||
|
} else {
|
||||||
|
die("Unable to determine current PHPMyAdmin version, exiting\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
checkHost(null, $pma_current);
|
||||||
|
if($hosts != null) {
|
||||||
|
foreach($hosts as $host) {
|
||||||
|
checkHost($host, $pma_current);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkHost($host, $pma_current) {
|
||||||
|
$cmd = "locate libraries/Config.class.php | xargs grep -H 'PMA_VERSION' | grep set";
|
||||||
|
$hostidentifier = "localhost:";
|
||||||
|
if( $host != null ) {
|
||||||
|
$cmd = "ssh $host \"" . $cmd . "\"";
|
||||||
|
$hostidentifier = $host . ":";
|
||||||
|
}
|
||||||
|
exec($cmd, $results);
|
||||||
|
foreach($results as $instance) {
|
||||||
|
$parts = explode(':', $instance);
|
||||||
|
$location = substr($parts[0], 0, strlen($parts[0])-26);
|
||||||
|
preg_match("/->set\('PMA_VERSION', '([0-9\.a-z]+)'\);/", $parts[1], $matches);
|
||||||
|
$version = $matches[1];
|
||||||
|
if($version < $pma_current) {
|
||||||
|
echo "WARNING: Outdated PHPMyAdmin $version at $hostidentifier$location\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($results);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -1,18 +1,12 @@
|
|||||||
#!/usr/bin/php -q
|
#!/usr/bin/php -q
|
||||||
<?
|
<?
|
||||||
// Fetch the host list to check
|
require_once("toolkit.php");
|
||||||
//
|
|
||||||
if( getenv('CHK_HOSTS') == null ) {
|
|
||||||
$hosts = null;
|
|
||||||
}else {
|
|
||||||
$hosts = explode(' ', getenv('CHK_HOSTS'));
|
|
||||||
if (implode($hosts)=='') die("No hosts to check.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Retrieve current Wordpress version from http://api.wordpress.org/core/version-check/1.6/
|
// Retrieve current Wordpress version from http://api.wordpress.org/core/version-check/1.6/
|
||||||
//
|
//
|
||||||
$wp_api = unserialize(file_get_contents("http://api.wordpress.org/core/version-check/1.6/"));
|
$wp_api = unserialize(file_get_contents("http://api.wordpress.org/core/version-check/1.6/"));
|
||||||
$wp_current = $wp_api['offers'][0]['current'];
|
$wp_current = $wp_api['offers'][0]['current'];
|
||||||
|
verbose("Current Wordpress version: $wp_current", 1);
|
||||||
|
|
||||||
checkHost(null, $wp_current);
|
checkHost(null, $wp_current);
|
||||||
if( $hosts != null ) {
|
if( $hosts != null ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user