X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FExpire.php;h=713bfa25e0ad67f6a6f9caab456ba5de7375dffd;hb=1e9bff88bc05fce154edee9f047e7d8922184140;hp=822a4389df6cdfd6d7f6a243b5dadbe0034e0b0e;hpb=174ae78ec18dfc114324c75687d2c8553c4cc1c5;p=friendica.git diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php index 822a4389df..713bfa25e0 100644 --- a/src/Worker/Expire.php +++ b/src/Worker/Expire.php @@ -9,8 +9,8 @@ namespace Friendica\Worker; use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; -use Friendica\Model\Item; use Friendica\Database\DBM; +use Friendica\Model\Item; use dba; require_once 'include/dba.php'; @@ -19,7 +19,6 @@ class Expire { public static function execute($param = '', $hook_name = '') { global $a; - require_once 'include/datetime.php'; require_once 'include/items.php'; Addon::loadHooks(); @@ -27,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);