]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Worker/Daemon.php
Merge pull request #11763 from tobiasd/marcor-newapi
[friendica.git] / src / Core / Worker / Daemon.php
index afc6cda4ecb13641125a152b433690206593538b..6fd64e4f595bdb4664aa73a944d955ab2804c462 100644 (file)
@@ -30,7 +30,7 @@ use Friendica\DI;
  */
 class Daemon
 {
-       private static $daemon_mode = null;
+       private static $mode = null;
 
        /**
         * Checks if the worker is running in the daemon mode.
@@ -39,8 +39,8 @@ class Daemon
         */
        public static function isMode()
        {
-               if (!is_null(self::$daemon_mode)) {
-                       return self::$daemon_mode;
+               if (!is_null(self::$mode)) {
+                       return self::$mode;
                }
 
                if (DI::mode()->getExecutor() == Mode::DAEMON) {
@@ -53,27 +53,27 @@ class Daemon
                }
 
                if (!function_exists('pcntl_fork')) {
-                       self::$daemon_mode = false;
+                       self::$mode = false;
                        return false;
                }
 
                $pidfile = DI::config()->get('system', 'pidfile');
                if (empty($pidfile)) {
                        // No pid file, no daemon
-                       self::$daemon_mode = false;
+                       self::$mode = false;
                        return false;
                }
 
                if (!is_readable($pidfile)) {
                        // No pid file. We assume that the daemon had been intentionally stopped.
-                       self::$daemon_mode = false;
+                       self::$mode = false;
                        return false;
                }
 
-               $pid = intval(file_get_contents($pidfile));
+               $pid     = intval(file_get_contents($pidfile));
                $running = posix_kill($pid, 0);
 
-               self::$daemon_mode = $running;
+               self::$mode = $running;
                return $running;
        }
 
@@ -129,9 +129,7 @@ class Daemon
        private static function spawn()
        {
                Logger::notice('Starting new daemon process');
-               $command = 'bin/daemon.php';
-               $a = DI::app();
-               DI::system()->run($command, ['start']);
+               DI::system()->run('bin/daemon.php', ['start']);
                Logger::notice('New daemon process started');
        }
 }