]> git.mxchange.org Git - friendica.git/blob - include/expire.php
Merge pull request #3030 from Hypolite/bug/proxy_url_extension
[friendica.git] / include / expire.php
1 <?php
2
3 require_once("boot.php");
4
5 function expire_run(&$argv, &$argc){
6         global $a, $db;
7
8         if(is_null($a)) {
9                 $a = new App;
10         }
11
12         if(is_null($db)) {
13             @include(".htconfig.php");
14         require_once("include/dba.php");
15             $db = new dba($db_host, $db_user, $db_pass, $db_data);
16         unset($db_host, $db_user, $db_pass, $db_data);
17         };
18
19         require_once('include/session.php');
20         require_once('include/datetime.php');
21         require_once('include/items.php');
22         require_once('include/Contact.php');
23
24         load_config('config');
25         load_config('system');
26
27         $a->set_baseurl(get_config('system','url'));
28
29
30         // physically remove anything that has been deleted for more than two months
31
32         $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY");
33
34         // make this optional as it could have a performance impact on large sites
35
36         if(intval(get_config('system','optimize_items')))
37                 q("optimize table item");
38
39         logger('expire: start');
40
41         $r = q("SELECT `uid`,`username`,`expire` FROM `user` WHERE `expire` != 0");
42         if (dbm::is_result($r)) {
43                 foreach($r as $rr) {
44                         logger('Expire: ' . $rr['username'] . ' interval: ' . $rr['expire'], LOGGER_DEBUG);
45                         item_expire($rr['uid'],$rr['expire']);
46                 }
47         }
48
49         load_hooks();
50
51         call_hooks('expire');
52
53         return;
54 }
55
56 if (array_search(__file__,get_included_files())===0){
57   expire_run($_SERVER["argv"],$_SERVER["argc"]);
58   killme();
59 }