properly exit script if no version was detected, for drupal and wordpress (courtesy WvR)
This commit is contained in:
11
run.d/drupal
11
run.d/drupal
@@ -15,12 +15,11 @@ $context = stream_context_create(array(
|
||||
$data = file_get_contents($url, FALSE, $context);
|
||||
if($data)
|
||||
$feed = simplexml_load_string($data);
|
||||
if($feed && $feed instanceof SimpleXMLElement) {
|
||||
// Check the property exists and assign
|
||||
if( isset($feed->releases->release[0]->version) ) {
|
||||
$dr_current = $feed->releases->release[0]->version;
|
||||
// return $latest;
|
||||
}
|
||||
if($feed && $feed instanceof SimpleXMLElement && isset($feed->releases->release[0]->version)) {
|
||||
$dr_current = $feed->releases->release[0]->version;
|
||||
verbose("Current Drupal version: $dr_current", 1);
|
||||
} else {
|
||||
die("Unable to determine current Drupal version, exiting\n");
|
||||
}
|
||||
|
||||
verbose("Current Drupal version: $dr_current", 1);
|
||||
|
||||
@@ -5,8 +5,12 @@ require_once("toolkit.php");
|
||||
// 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_current = $wp_api['offers'][0]['current'];
|
||||
verbose("Current Wordpress version: $wp_current", 1);
|
||||
if( isset($wp_api['offers'][0]['current']) ) {
|
||||
$wp_current = $wp_api['offers'][0]['current'];
|
||||
verbose("Current Wordpress version: $wp_current", 1);
|
||||
} else {
|
||||
die("Unable to determine current Wordpress version, exiting\n");
|
||||
}
|
||||
|
||||
checkHost(null, $wp_current);
|
||||
if( $hosts != null ) {
|
||||
|
||||
Reference in New Issue
Block a user