]> git.mxchange.org Git - friendica.git/blob - scripts/worker.php
Network page: Selecting a forum overrides the group selection
[friendica.git] / scripts / worker.php
1 <?php
2 use Friendica\App;
3 use Friendica\Core\Worker;
4 use Friendica\Core\Config;
5
6 // Ensure that worker.php is executed from the base path of the installation
7 if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
8         $directory = dirname($_SERVER["argv"][0]);
9
10         if (substr($directory, 0, 1) != "/") {
11                 $directory = $_SERVER["PWD"]."/".$directory;
12         }
13         $directory = realpath($directory."/..");
14
15         chdir($directory);
16 }
17
18 require_once "boot.php";
19 require_once "include/dba.php";
20
21 $a = new App(dirname(__DIR__));
22
23 require_once ".htconfig.php";
24 dba::connect($db_host, $db_user, $db_pass, $db_data);
25 unset($db_host, $db_user, $db_pass, $db_data);
26
27 Config::load();
28
29 // Check the database structure and possibly fixes it
30 check_db(true);
31
32 // Quit when in maintenance
33 if (Config::get('system', 'maintenance', true)) {
34         return;
35 }
36
37 $a->set_baseurl(Config::get('system', 'url'));
38
39 load_hooks();
40
41 $run_cron = (($_SERVER["argc"] <= 1) || ($_SERVER["argv"][1] != "no_cron"));
42 Worker::processQueue($run_cron);
43
44 Worker::unclaimProcess();
45
46 $a->end_process();
47
48 killme();
49