5 * @brief Starts the background processing
9 use Friendica\Core\Addon;
10 use Friendica\Core\Config;
11 use Friendica\Core\Worker;
12 use Friendica\Core\L10n;
16 $longopts = ['spawn', 'no_cron'];
17 $options = getopt($shortopts, $longopts);
19 // Ensure that worker.php is executed from the base path of the installation
20 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
21 $directory = dirname($_SERVER["argv"][0]);
23 if (substr($directory, 0, 1) != "/") {
24 $directory = $_SERVER["PWD"]."/".$directory;
26 $directory = realpath($directory."/..");
31 require_once "boot.php";
33 $a = new App(dirname(__DIR__));
37 $lang = L10n::getBrowserLanguage();
38 L10n::loadTranslationTable($lang);
40 // Check the database structure and possibly fixes it
43 // Quit when in maintenance
44 if (Config::get('system', 'maintenance', false, true)) {
48 $a->set_baseurl(Config::get('system', 'url'));
52 $spawn = array_key_exists('s', $options) || array_key_exists('spawn', $options);
55 Worker::spawnWorker();
59 $run_cron = !array_key_exists('n', $options) && !array_key_exists('no_cron', $options);
61 Worker::processQueue($run_cron);
63 Worker::unclaimProcess();