add scripts for CakePHP and PHPMyAdmin, courtesy of WvR.

Also include new logging options (verbosity)
This commit is contained in:
florian
2013-10-05 15:45:31 +00:00
parent 556fe14b86
commit e0da46edca
5 changed files with 87 additions and 16 deletions

39
run.d/cakephp Normal file
View 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);
}
?>