]> git.mxchange.org Git - friendica.git/blob - include/cronhooks.php
Merge remote-tracking branch 'upstream/master'
[friendica.git] / include / cronhooks.php
1 <?php
2
3 require_once("boot.php");
4
5
6 function cronhooks_run(&$argv, &$argc){
7         global $a, $db;
8
9         if(is_null($a)) {
10                 $a = new App;
11         }
12   
13         if(is_null($db)) {
14             @include(".htconfig.php");
15         require_once("include/dba.php");
16             $db = new dba($db_host, $db_user, $db_pass, $db_data);
17         unset($db_host, $db_user, $db_pass, $db_data);
18         };
19
20         require_once('include/session.php');
21         require_once('include/datetime.php');
22         require_once('include/pidfile.php');
23
24         load_config('config');
25         load_config('system');
26
27         if ($hostname =  get_config('system', 'hostname'))
28                 $a->set_hostname($hostname);
29
30         $lockpath = get_config('system','lockpath');
31         if ($lockpath != '') {
32                 $pidfile = new pidfile($lockpath, 'cron.lck');
33                 if($pidfile->is_already_running()) {
34                         logger("cronhooks: Already running");
35                         exit;
36                 }
37         }
38
39         $a->set_baseurl(get_config('system','url'));
40
41         load_hooks();
42
43         logger('cronhooks: start');
44         
45
46         $d = datetime_convert();
47
48         call_hooks('cron', $d);
49
50         return;
51 }
52
53 if (array_search(__file__,get_included_files())===0){
54   cronhooks_run($argv,$argc);
55   killme();
56 }