From 16956646460aef1d8e0c41b261ce56af88e2f4f6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 22 Mar 2010 11:17:58 +0300 Subject: [PATCH] daemon: fallback automatically when pcntl_signal() is not present --- update_daemon.php | 8 ++++++-- update_daemon2.php | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/update_daemon.php b/update_daemon.php index b2bae956..03d366b5 100755 --- a/update_daemon.php +++ b/update_daemon.php @@ -44,8 +44,12 @@ die("received SIGALRM, hang in feed update?\n"); } - pcntl_signal(SIGINT, sigint_handler); - pcntl_signal(SIGALRM, sigalrm_handler); + if (function_exists('pcntl_signal')) { + pcntl_signal(SIGINT, sigint_handler); + pcntl_signal(SIGALRM, sigalrm_handler); + } else { + _debug("Warning: pcntl_signal function not present, continuing without support for signals."); + } $lock_handle = make_lockfile("update_daemon.lock"); diff --git a/update_daemon2.php b/update_daemon2.php index a8eb48d4..779373a6 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -27,8 +27,12 @@ define('SPAWN_INTERVAL', DAEMON_SLEEP_INTERVAL); + if (!function_exists('pcntl_fork')) { + die("error: This script requires PHP compiled with PCNTL module.\n"); + } + if (!ENABLE_UPDATE_DAEMON) { - die("Please enable option ENABLE_UPDATE_DAEMON in config.php\n"); + die("error: Please enable option ENABLE_UPDATE_DAEMON in config.php\n"); } require_once "db.php"; -- 2.39.2