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.

53 lines
1.2 KiB

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