Delete of item-content should work now

This commit is contained in:
Michael 2018-06-25 20:23:32 +00:00
parent 89f0eec261
commit 6b568bb8fa
3 changed files with 7 additions and 2 deletions

View file

@ -26,9 +26,12 @@ class Expire {
if ($param == 'delete') {
logger('Delete expired items', LOGGER_DEBUG);
// 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 = dba::p("SELECT `id`, `icid` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
while ($row = dba::fetch($r)) {
dba::delete('item', ['id' => $row['id']]);
if (!dba::exists('item', ['icid' => $row['icid']])) {
dba::delete('item-content', ['id' => $row['icid']]);
}
}
dba::close($r);