MINOR Unified messages in URLCheck, removed "homepage" references

This commit is contained in:
Ingo Schommer 2012-01-20 17:47:24 +01:00
parent 5c13c1b7a5
commit 0946addf7e
1 changed files with 12 additions and 3 deletions

View File

@ -51,13 +51,22 @@ class URLCheck implements EnvironmentCheck {
$response = Director::test($this->url);
if($response->getStatusCode() != 200) {
return array(EnvironmentCheck::ERROR, "Homepage requested and returned HTTP " . $response->getStatusCode() . " response");
return array(
EnvironmentCheck::ERROR,
sprintf('Error retrieving "%s" (Code: %d)', $this->url, $response->getStatusCode())
);
} else if($this->testString && (strpos($response->getBody(), $this->testString) === false)) {
return array(EnvironmentCheck::WARNING, "Homepage requested ok but '$testString' not found.");
return array(
EnvironmentCheck::WARNING,
sprintf('Success retrieving "%s", but string "%s" not found', $this->url, $testString)
);
} else {
return array(EnvironmentCheck::OK, "");
return array(
EnvironmentCheck::OK,
sprintf('Success retrieving "%s"', $this->url)
);
}
}
}