Change xmpp config and message files directory

This commit is contained in:
zviryatko 2015-03-28 16:50:40 +02:00 committed by Tobias van Beek
parent 524341a50b
commit 731fd65453

View file

@ -132,8 +132,8 @@ class XMPP implements \PHPCI\Plugin
*/
public function findConfigFile()
{
if (file_exists('.sendxmpprc')) {
if (md5(file_get_contents('.sendxmpprc')) !== md5($this->getConfigFormat())) {
if (file_exists($this->phpci->buildPath . '/.sendxmpprc')) {
if (md5(file_get_contents($this->phpci->buildPath . '/.sendxmpprc')) !== md5($this->getConfigFormat())) {
return null;
}
@ -165,9 +165,10 @@ class XMPP implements \PHPCI\Plugin
/*
* Try to build conf file
*/
$config_file = $this->phpci->buildPath . '/.sendxmpprc';
if (is_null($this->findConfigFile())) {
file_put_contents('.sendxmpprc', $this->getConfigFormat());
chmod('.sendxmpprc', 0600);
file_put_contents($config_file, $this->getConfigFormat());
chmod($config_file, 0600);
}
/*
@ -178,7 +179,7 @@ class XMPP implements \PHPCI\Plugin
$tls = ' -t';
}
$message_file = uniqid('xmppmessage');
$message_file = $this->phpci->buildPath . '/' . uniqid('xmppmessage');
if ($this->buildMessage($message_file) === false) {
return false;
}
@ -186,10 +187,10 @@ class XMPP implements \PHPCI\Plugin
/*
* Send XMPP notification for all recipients
*/
$cmd = $sendxmpp . "%s -f .sendxmpprc -m %s %s";
$cmd = $sendxmpp . "%s -f %s -m %s %s";
$recipients = implode(' ', $this->recipients);
$success = $this->phpci->executeCommand($cmd, $tls, $message_file, $recipients);
$success = $this->phpci->executeCommand($cmd, $tls, $config_file, $message_file, $recipients);
print $this->phpci->getLastOutput();