X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fexpire.php;h=098125a79864efb3315fe75ebd2319b6eca5a0de;hb=c0b5339691d63fcbae6caa7a032923d2826f9df0;hp=855d7fb5e44abc544f7eb5f7f5364e7bd05253f6;hpb=45ebeba643a6d600e8778475f70f827f32bf3146;p=friendica.git diff --git a/include/expire.php b/include/expire.php index 855d7fb5e4..098125a798 100644 --- a/include/expire.php +++ b/include/expire.php @@ -2,40 +2,22 @@ use \Friendica\Core\Config; -require_once("boot.php"); - function expire_run(&$argv, &$argc){ - global $a, $db; - - if(is_null($a)) { - $a = new App; - } + global $a; - if(is_null($db)) { - @include(".htconfig.php"); - require_once("include/dba.php"); - $db = new dba($db_host, $db_user, $db_pass, $db_data); - unset($db_host, $db_user, $db_pass, $db_data); - }; - - require_once('include/session.php'); require_once('include/datetime.php'); require_once('include/items.php'); require_once('include/Contact.php'); - Config::load(); - - $a->set_baseurl(get_config('system','url')); - - // physically remove anything that has been deleted for more than two months - $r = q("delete from item where deleted = 1 and changed < UTC_TIMESTAMP() - INTERVAL 60 DAY"); + $r = q("DELETE FROM `item` WHERE `deleted` = 1 AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"); // make this optional as it could have a performance impact on large sites - if(intval(get_config('system','optimize_items'))) - q("optimize table item"); + if (intval(get_config('system','optimize_items'))) { + q("OPTIMIZE TABLE `item`"); + } logger('expire: start'); @@ -53,8 +35,3 @@ function expire_run(&$argv, &$argc){ return; } - -if (array_search(__file__,get_included_files())===0){ - expire_run($_SERVER["argv"],$_SERVER["argc"]); - killme(); -}