mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fallback to shell_exec as some systems lack posix_mkfifo
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
2
irc.php
2
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user