Fallback to shell_exec as some systems lack posix_mkfifo

This commit is contained in:
f0o
2015-03-15 15:14:10 +00:00
parent 478916af4b
commit adebcf6c29
2 changed files with 10 additions and 8 deletions

View File

@@ -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 ) {
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 {
} else {
return true;
}
}

View File

@@ -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;
}