]> git.mxchange.org Git - friendica.git/blob - include/cronjobs.php
f0a56370b81566dca314f50ab8e3164533b93f7d
[friendica.git] / include / cronjobs.php
1 <?php
2 use \Friendica\Core\Config;
3
4 if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) {
5         $directory = dirname($_SERVER["argv"][0]);
6
7         if (substr($directory, 0, 1) != "/")
8                 $directory = $_SERVER["PWD"]."/".$directory;
9
10         $directory = realpath($directory."/..");
11
12         chdir($directory);
13 }
14
15 require_once("boot.php");
16
17
18 function cronjobs_run(&$argv, &$argc){
19         global $a, $db;
20
21         if(is_null($a)) {
22                 $a = new App;
23         }
24
25         if(is_null($db)) {
26                 @include(".htconfig.php");
27                 require_once("include/dba.php");
28                 $db = new dba($db_host, $db_user, $db_pass, $db_data);
29                 unset($db_host, $db_user, $db_pass, $db_data);
30         };
31
32         require_once('include/session.php');
33         require_once('include/datetime.php');
34         require_once('include/ostatus.php');
35         require_once('include/post_update.php');
36         require_once('mod/nodeinfo.php');
37
38         Config::load();
39
40         $a->set_baseurl(get_config('system','url'));
41
42         // No parameter set? So return
43         if ($argc <= 1)
44                 return;
45
46         // Check OStatus conversations
47         // Check only conversations with mentions (for a longer time)
48         if ($argv[1] == 'ostatus_mentions') {
49                 ostatus::check_conversations(true);
50                 return;
51         }
52
53         // Check every conversation
54         if ($argv[1] == 'ostatus_conversations') {
55                 ostatus::check_conversations(false);
56                 return;
57         }
58
59         // Call possible post update functions
60         // see include/post_update.php for more details
61         if ($argv[1] == 'post_update') {
62                 post_update();
63                 return;
64         }
65
66         // update nodeinfo data
67         if ($argv[1] == 'nodeinfo') {
68                 nodeinfo_cron();
69                 return;
70         }
71
72         return;
73 }
74
75 if (array_search(__file__,get_included_files())===0){
76         cronjobs_run($_SERVER["argv"],$_SERVER["argc"]);
77         killme();
78 }