mirror of
https://github.com/friendica/friendica
synced 2025-04-27 23:10:12 +00:00
Improve expire for item-content and item-activity
This commit is contained in:
parent
44e405d22b
commit
014eea8e12
2 changed files with 9 additions and 2 deletions
|
@ -26,10 +26,13 @@ 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`, `icid` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
|
||||
$r = dba::p("SELECT `id`, `iaid`, `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']])) {
|
||||
if (!empty($row['iaid']) && !dba::exists('item', ['iaid' => $row['iaid']])) {
|
||||
dba::delete('item-content', ['id' => $row['icid']]);
|
||||
}
|
||||
if (!empty($row['icid']) && !dba::exists('item', ['icid' => $row['icid']])) {
|
||||
dba::delete('item-content', ['id' => $row['icid']]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue