瀏覽代碼

Add function_exists for posix_getsid

Used to support operating systems that don't support posix_getsid
FusionPBX 7 月之前
父節點
當前提交
2070415573
共有 1 個文件被更改,包括 15 次插入6 次删除
  1. 15 6
      core/email_queue/resources/jobs/email_send.php

+ 15 - 6
core/email_queue/resources/jobs/email_send.php

@@ -49,12 +49,20 @@
 		//check to see if the process is running
 		if (file_exists($file)) {
 			$pid = file_get_contents($file);
-			if (posix_getsid($pid) === false) {
-				//process is not running
-				$exists = false;
+			if (function_exists('posix_getsid')) {
+				//check if the process is running
+				$pid = posix_getsid($pid);
+				if ($pid === null || $pid === 0) {
+					//process is not running
+					$exists = false;
+				}
+				else {
+					//process is running
+					$exists = true;
+				}
 			}
 			else {
-				//process is running
+				//file exists assume the pid is running
 				$exists = true;
 			}
 		}
@@ -64,7 +72,9 @@
 	}
 
 //check to see if the process exists
-	$pid_exists = process_exists($pid_file);
+	if (function_exists('posix_getsid')) {
+		$pid_exists = process_exists($pid_file);
+	}
 
 //prevent the process running more than once
 	if ($pid_exists) {
@@ -571,4 +581,3 @@
 
 	//fwrite($esl, $content);
 	//fclose($esl);
-