This item removal is much more cleaner

This commit is contained in:
Michael 2017-05-12 06:17:48 +00:00
parent c00a5223d6
commit 11e524a555

View file

@ -10,8 +10,13 @@ function expire_run(&$argv, &$argc){
require_once('include/Contact.php'); require_once('include/Contact.php');
// physically remove anything that has been deleted for more than two months // physically remove anything that has been deleted for more than two months
$r = dba::p("SELECT `id` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
$r = q("DELETE FROM `item` WHERE `deleted` = 1 AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"); if (dbm::is_result($r)) {
while ($row = dba::fetch($r)) {
dba::delete('item', array('id' => $row['id']));
}
dba::close($r);
}
// make this optional as it could have a performance impact on large sites // make this optional as it could have a performance impact on large sites