PHPCI/Plugin/XMPP.php : Add test on empty recipients list and add test to check that all command was successful
This commit is contained in:
parent
9deb00a096
commit
97d6a6030b
|
@ -151,6 +151,13 @@ class XMPP implements \PHPCI\Plugin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Without recipients we can't send notification
|
||||||
|
*/
|
||||||
|
if (count($this->recipients) == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to build conf file
|
* Try to build conf file
|
||||||
*/
|
*/
|
||||||
|
@ -181,13 +188,16 @@ class XMPP implements \PHPCI\Plugin
|
||||||
/*
|
/*
|
||||||
* Send XMPP notification for all recipients
|
* Send XMPP notification for all recipients
|
||||||
*/
|
*/
|
||||||
$success = false;
|
$success = array()
|
||||||
foreach($this->recipients as $recipient) {
|
foreach($this->recipients as $recipient) {
|
||||||
$success = $this->phpci->executeCommand('echo %s | ' . $sendxmpp .
|
if($cmd = $this->phpci->executeCommand('echo %s | ' . $sendxmpp .
|
||||||
' %s %s', $message, $tls, $recipients);
|
' %s %s', $message, $tls, $recipients)) {
|
||||||
|
$success[] = $cmd;
|
||||||
|
}
|
||||||
|
|
||||||
print $this->phpci->getLastOutput();
|
print $this->phpci->getLastOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $success;
|
return (count($success) === count($this->recipients));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue