Add support for site online when pattern not found
patterns prefixed with "!" will count as mark site offline when this string is foundpull/579/head
parent
fc4ffd6b2f
commit
5bc7c1e4ea
|
@ -248,9 +248,11 @@ class StatusUpdater {
|
|||
|
||||
//Okay, the HTTP status is good : 2xx or 3xx. Now we have to test the pattern if it's set up
|
||||
if($this->server['pattern'] != '') {
|
||||
// Check to see if the pattern was found.
|
||||
if(!preg_match("/{$this->server['pattern']}/i", $curl_result)) {
|
||||
$this->error = 'TEXT ERROR : Pattern not found.';
|
||||
// Check to see if the body should not contain specified pattern
|
||||
$negative_search = substr($this->server['pattern'], 0, 1) === '!';
|
||||
// Check to see if the pattern was [not] found.
|
||||
if($negative_search ? preg_match("/" . substr($this->server['pattern'],1) . "/i", $curl_result) : !preg_match("/{$this->server['pattern']}/i", $curl_result)) {
|
||||
$this->error = 'TEXT ERROR : Pattern ' . ($negative_search ? 'was' : 'not') . ' found.';
|
||||
$result = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue