From 0ea8595cd340eb45e279cf2b5c1af83e2d0b7678 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 8 Oct 2013 08:15:47 +0000 Subject: [PATCH] - improved finding location/version for phpmyadmin - changed all logging to use verbose - implemented verbosity level 2, which prints all versions found (recent ones too) --- run.d/cakephp | 4 +++- run.d/drupal | 6 +++++- run.d/phpmyadmin | 13 ++++++++----- run.d/wordpress | 4 +++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/run.d/cakephp b/run.d/cakephp index 7610474..6a45c45 100644 --- a/run.d/cakephp +++ b/run.d/cakephp @@ -30,7 +30,9 @@ function checkHost($host, $cake_current) { $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"; + verbose("WARNING: Outdated CakePHP $version at $hostidentifier$location", 0); + } else { + verbose("Recent CakePHP $version at $hostidentifier$location", 2); } } unset($results); diff --git a/run.d/drupal b/run.d/drupal index 505e917..c89d053 100755 --- a/run.d/drupal +++ b/run.d/drupal @@ -66,7 +66,11 @@ function checkHost($host, $dr_current) { $location = substr($parts[0], 0, strlen($parts[0])-23); if(substr($parts[1], 0, 16) == "define('VERSION'") { $version = substr($parts[1], 19, strpos($parts[1], "'", 19)-19); - if($version < $dr_current) echo "WARNING: Outdated Drupal $version at $host:$location\n"; + if($version < $dr_current) { + verbose("WARNING: Outdated Drupal $version at $host:$location", 0); + } else { + verbose("Recent Drupal $version at $host:$location", 2); + } } } unset($results); diff --git a/run.d/phpmyadmin b/run.d/phpmyadmin index f01f341..5695653 100755 --- a/run.d/phpmyadmin +++ b/run.d/phpmyadmin @@ -18,7 +18,7 @@ if($hosts != null) { } function checkHost($host, $pma_current) { - $cmd = "locate libraries/Config.class.php | xargs grep -H 'PMA_VERSION' | grep set"; + $cmd = "locate libraries/Config.class.php | xargs grep -H \"'PMA_VERSION'\" | grep set"; $hostidentifier = "localhost:"; if( $host != null ) { $cmd = "ssh $host \"" . $cmd . "\""; @@ -28,10 +28,13 @@ function checkHost($host, $pma_current) { 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"; + if(preg_match("/->set\('PMA_VERSION', '([0-9\.a-z]+)'\);/", $parts[1], $matches)) { + $version = $matches[1]; + if($version < $pma_current) { + verbose("WARNING: Outdated PHPMyAdmin $version at $hostidentifier$location", 0); + } else { + verbose("Recent PHPMyAdmin $version at $hostidentifier$location", 2); + } } } unset($results); diff --git a/run.d/wordpress b/run.d/wordpress index f2e5b16..8b0465c 100755 --- a/run.d/wordpress +++ b/run.d/wordpress @@ -29,7 +29,9 @@ function checkHost($host, $wp_current) { preg_match("/wp_version = '([0-9]+\.[0-9]+(\.[0-9]+)?)';/", $parts[1], $matches); $version = $matches[1]; if($version < $wp_current) { - echo "WARNING: Outdated Wordpress $version at $hostidentifier$location\n"; + verbose("WARNING: Outdated Wordpress $version at $hostidentifier$location", 0); + } else { + verbose("Recent Wordpress $version at $hostidentifier$location", 2); } } unset($results);