]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Daemon can optionally not go into the background
authorEvan Prodromou <evan@controlyourself.ca>
Sun, 28 Jun 2009 20:12:23 +0000 (16:12 -0400)
committerEvan Prodromou <evan@controlyourself.ca>
Sun, 28 Jun 2009 20:12:23 +0000 (16:12 -0400)
lib/daemon.php
lib/queuehandler.php

index a0df00bdcc852cc434f025ed6f062aa4496a653d..72e8bc20286a7a97ebe62f03088a4912a957082c 100644 (file)
@@ -23,6 +23,13 @@ if (!defined('LACONICA')) {
 
 class Daemon
 {
+    var $daemonize = true;
+
+    function __construct($daemonize = true)
+    {
+        $this->daemonize = $daemonize;
+    }
+
     function name()
     {
         return null;
@@ -129,12 +136,15 @@ class Daemon
             common_log(LOG_INFO, $this->name() . ' already running. Exiting.');
             exit(0);
         }
-        if ($this->background()) {
-            $this->writePidFile();
-            $this->changeUser();
-            $this->run();
-            $this->clearPidFile();
+
+        if ($this->daemonize) {
+            $this->background();
         }
+
+        $this->writePidFile();
+        $this->changeUser();
+        $this->run();
+        $this->clearPidFile();
     }
 
     function run()
index ae403c65e24f815f4f38b56b9ec081e760092074..c1c4f3309a24011b60e72de070a5fcef0267ad56 100644 (file)
@@ -27,11 +27,12 @@ require_once(INSTALLDIR.'/classes/Notice.php');
 
 class QueueHandler extends Daemon
 {
-
     var $_id = 'generic';
 
-    function QueueHandler($id=null)
+    function __construct($id=null, $daemonize=true)
     {
+        parent::__construct($daemonize);
+
         if ($id) {
             $this->set_id($id);
         }