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]);
$a = new App(dirname(__DIR__));
-if ($a->isInstallMode()) {
+if (App\Mode::isInstall()) {
die("Friendica isn't properly installed yet.\n");
}
$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");