5 * @brief Starts the background processing
9 use Friendica\BaseObject;
10 use Friendica\Core\Addon;
11 use Friendica\Core\Config;
12 use Friendica\Core\Worker;
14 // Ensure that worker.php is executed from the base path of the installation
15 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
16 $directory = dirname($_SERVER["argv"][0]);
18 if (substr($directory, 0, 1) != "/") {
19 $directory = $_SERVER["PWD"]."/".$directory;
21 $directory = realpath($directory."/..");
26 require_once "boot.php";
27 require_once "include/dba.php";
29 $a = new App(dirname(__DIR__));
31 require_once ".htconfig.php";
32 dba::connect($db_host, $db_user, $db_pass, $db_data);
33 unset($db_host, $db_user, $db_pass, $db_data);
37 // Check the database structure and possibly fixes it
40 // Quit when in maintenance
41 if (Config::get('system', 'maintenance', false, true)) {
45 $a->set_baseurl(Config::get('system', 'url'));
49 $spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
52 Worker::spawnWorker();
56 $run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
58 Worker::processQueue($run_cron);
60 Worker::unclaimProcess();