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