]> git.wh0rd.org - tt-rss.git/commitdiff
daemon: fallback automatically when pcntl_signal() is not present
authorAndrew Dolgov <fox@bah.org.ru>
Mon, 22 Mar 2010 08:17:58 +0000 (11:17 +0300)
committerAndrew Dolgov <fox@bah.org.ru>
Mon, 22 Mar 2010 08:17:58 +0000 (11:17 +0300)
update_daemon.php
update_daemon2.php

index b2bae956e981e075f2ceca5943bfea663aa4c628..03d366b5e23070e90c2915c5d4f9bfd877f65613 100755 (executable)
                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");
 
index a8eb48d4c2bfcf43cef3b120290cba8ed9664dee..779373a632faba6c273b962348cbaf343aefb89c 100755 (executable)
 
        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";