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__));
30 BaseObject::setApp($a);
32 require_once ".htconfig.php";
33 dba::connect($db_host, $db_user, $db_pass, $db_data);
34 unset($db_host, $db_user, $db_pass, $db_data);
38 // Check the database structure and possibly fixes it
41 // Quit when in maintenance
42 if (Config::get('system', 'maintenance', false, true)) {
46 $a->set_baseurl(Config::get('system', 'url'));
50 $spawn = (($_SERVER["argc"] == 2) && ($_SERVER["argv"][1] == "spawn"));
53 Worker::spawnWorker();
57 $run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
59 Worker::processQueue($run_cron);
61 Worker::unclaimProcess();