Skip to content

Commit

Permalink
daemon: fallback automatically when pcntl_signal() is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Dolgov committed Mar 22, 2010
1 parent 36d146f commit 1695664
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions update_daemon.php
Expand Up @@ -44,8 +44,12 @@ function sigalrm_handler() {
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");

Expand Down
6 changes: 5 additions & 1 deletion update_daemon2.php
Expand Up @@ -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";
Expand Down

0 comments on commit 1695664

Please sign in to comment.