If no pcntl extension is found, do not fork the traffic - cron, fix by d4f, fixes #1028

Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
Florian Aders (EleRas)
2012-02-27 19:55:12 +01:00
parent 7ace2a8a4b
commit 5d60b25900

View File

@@ -18,6 +18,7 @@
*/ */
//Check Traffic-Lock //Check Traffic-Lock
if(function_exists('pcntl_fork')) {
$TrafficLock = dirname($lockfile)."/froxlor_cron_traffic.lock"; $TrafficLock = dirname($lockfile)."/froxlor_cron_traffic.lock";
if(file_exists($TrafficLock) && is_numeric($TrafficPid=file_get_contents($TrafficLock))) { if(file_exists($TrafficLock) && is_numeric($TrafficPid=file_get_contents($TrafficLock))) {
if(function_exists('posix_kill')) { if(function_exists('posix_kill')) {
@@ -55,6 +56,10 @@ elseif($TrafficPid == 0) { //Child
else { //Fork failed else { //Fork failed
return 1; return 1;
} }
}
else {
fwrite($debugHandler,"PHP compiled without pcntl. Not forking traffic-cron, this may take a long time!");
}
openRootDB($debugHandler, $lockfile); openRootDB($debugHandler, $lockfile);
require_once(makeCorrectFile(dirname(__FILE__) . '/cron_traffic.inc.functions.php')); require_once(makeCorrectFile(dirname(__FILE__) . '/cron_traffic.inc.functions.php'));
@@ -520,6 +525,8 @@ $db->query('UPDATE `' . TABLE_PANEL_SETTINGS . '` SET `value` = UNIX_TIMESTAMP()
closeRootDB(); closeRootDB();
if(function_exists('pcntl_fork')) {
die(); die();
}
?> ?>