From: Michael Date: Fri, 12 May 2017 06:17:48 +0000 (+0000) Subject: This item removal is much more cleaner X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=11e524a5555b316e1787463acf5b318e09a847c5;p=friendica.git This item removal is much more cleaner --- diff --git a/include/expire.php b/include/expire.php index da121157d2..73bffb20dc 100644 --- a/include/expire.php +++ b/include/expire.php @@ -10,8 +10,13 @@ function expire_run(&$argv, &$argc){ require_once('include/Contact.php'); // 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 = dba::p("SELECT `id` FROM `item` WHERE `deleted` 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