4 * @file scripts/worker.php
5 * @brief Starts the background processing
9 use Friendica\Core\Worker;
10 use Friendica\Core\Config;
12 // Ensure that worker.php is executed from the base path of the installation
13 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
14 $directory = dirname($_SERVER["argv"][0]);
16 if (substr($directory, 0, 1) != "/") {
17 $directory = $_SERVER["PWD"]."/".$directory;
19 $directory = realpath($directory."/..");
24 require_once "boot.php";
25 require_once "include/dba.php";
27 $a = new App(dirname(__DIR__));
29 require_once ".htconfig.php";
30 dba::connect($db_host, $db_user, $db_pass, $db_data);
31 unset($db_host, $db_user, $db_pass, $db_data);
35 // Check the database structure and possibly fixes it
38 // Quit when in maintenance
39 if (Config::get('system', 'maintenance', true)) {
43 $a->set_baseurl(Config::get('system', 'url'));
47 $spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
50 Worker::spawnWorker();
54 $run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
56 Worker::processQueue($run_cron);
58 Worker::unclaimProcess();