Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.3 KiB

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