From adebcf6c291315eca5788aa2d7b862fa66e19b4c Mon Sep 17 00:00:00 2001 From: f0o Date: Sun, 15 Mar 2015 15:14:10 +0000 Subject: [PATCH] Fallback to shell_exec as some systems lack posix_mkfifo --- includes/alerts/transport.irc.php | 16 +++++++++------- irc.php | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/includes/alerts/transport.irc.php b/includes/alerts/transport.irc.php index 1380fb57b7..03fcc3cda7 100644 --- a/includes/alerts/transport.irc.php +++ b/includes/alerts/transport.irc.php @@ -22,11 +22,13 @@ */ $f = $config['install_dir']."/.ircbot.alert"; -$f = fopen($f,"w+"); -$r = fwrite($f,json_encode($obj)."\n"); -$f = fclose($f); -if( $r === false ) { - return false; -} else { - return true; +if( file_exists($f) && filetype($f) == "fifo" ) { + $f = fopen($f,"w+"); + $r = fwrite($f,json_encode($obj)."\n"); + $f = fclose($f); + if( $r === false ) { + return false; + } else { + return true; + } } diff --git a/irc.php b/irc.php index 84ac73ccb4..9e40253053 100755 --- a/irc.php +++ b/irc.php @@ -128,7 +128,7 @@ class ircbot { private function connect_alert() { $f = $this->config['install_dir']."/.ircbot.alert"; - if( ( file_exists($f) && filetype($f) != "fifo" && !unlink($f) ) || ( !file_exists($f) && !posix_mkfifo($f,0644) ) ) { + if( ( file_exists($f) && filetype($f) != "fifo" && !unlink($f) ) || ( !file_exists($f) && !shell_exec("mkfifo $f && echo 1") ) ) { $this->log("Error - Cannot create Alert-File"); return false; }