]> git.mxchange.org Git - friendica.git/blobdiff - bin/daemon.php
Merge pull request #5838 from tobiasd/20181006-lng
[friendica.git] / bin / daemon.php
index 449f92d1275e8f24e6b371b163afcdac496b22ff..e2bad90df59775e74ad4cd96164a84d6df41d13c 100755 (executable)
@@ -12,6 +12,11 @@ use Friendica\Core\Config;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
 
+// Get options
+$shortopts = 'f';
+$longopts = ['foreground'];
+$options = getopt($shortopts, $longopts);
+
 // Ensure that daemon.php is executed from the base path of the installation
 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
        $directory = dirname($_SERVER["argv"][0]);
@@ -29,7 +34,7 @@ require_once "include/dba.php";
 
 $a = new App(dirname(__DIR__));
 
-if ($a->isInstallMode()) {
+if (App\Mode::isInstall()) {
        die("Friendica isn't properly installed yet.\n");
 }
 
@@ -55,7 +60,7 @@ if (in_array("status", $_SERVER["argv"])) {
        $mode = "status";
 }
 
-$foreground = in_array("--foreground", $_SERVER["argv"]);
+$foreground = array_key_exists('f', $options) || array_key_exists('foreground', $options);
 
 if (!isset($mode)) {
        die("Please use either 'start', 'stop' or 'status'.\n");