X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FExpire.php;h=b6096b5849405d11b2f68fec6a81c245157a44ad;hb=d5c2c41b0289523f65dff634e3fdda3336ed6146;hp=7dd5a9b5a79581922b1265494f84b9a6a32c0db2;hpb=af6dbc654f82225cfc647fe2072662acae388e47;p=friendica.git diff --git a/src/Worker/Expire.php b/src/Worker/Expire.php index 7dd5a9b5a7..b6096b5849 100644 --- a/src/Worker/Expire.php +++ b/src/Worker/Expire.php @@ -11,7 +11,6 @@ use Friendica\Core\Addon; use Friendica\Core\Config; use Friendica\Core\Worker; use Friendica\Database\DBA; -use Friendica\Database\DBM; use Friendica\Model\Item; require_once 'include/dba.php'; @@ -30,20 +29,9 @@ class Expire logger('Delete expired items', LOGGER_DEBUG); // physically remove anything that has been deleted for more than two months $condition = ["`deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY"]; - $rows = DBA::select('item', ['id', 'iaid', 'icid', 'psid'], $condition); + $rows = DBA::select('item', ['id'], $condition); while ($row = DBA::fetch($rows)) { DBA::delete('item', ['id' => $row['id']]); - if (!empty($row['iaid']) && !DBA::exists('item', ['iaid' => $row['iaid']])) { - DBA::delete('item-activity', ['id' => $row['iaid']]); - } - if (!empty($row['icid']) && !DBA::exists('item', ['icid' => $row['icid']])) { - DBA::delete('item-content', ['id' => $row['icid']]); - } - // When the permission set will be used in photo and events as well. - // this query here needs to be extended. - if (!empty($row['psid']) && !DBA::exists('item', ['psid' => $row['psid']])) { - DBA::delete('permissionset', ['id' => $row['psid']]); - } } DBA::close($rows); @@ -52,12 +40,12 @@ class Expire logger('Deleting orphaned item activities - start', LOGGER_DEBUG); $condition = ["NOT EXISTS (SELECT `iaid` FROM `item` WHERE `item`.`iaid` = `item-activity`.`id`)"]; DBA::delete('item-activity', $condition); - logger('Orphaned item activities deleted: ' . DBA::affected_rows(), LOGGER_DEBUG); + logger('Orphaned item activities deleted: ' . DBA::affectedRows(), LOGGER_DEBUG); logger('Deleting orphaned item content - start', LOGGER_DEBUG); $condition = ["NOT EXISTS (SELECT `icid` FROM `item` WHERE `item`.`icid` = `item-content`.`id`)"]; DBA::delete('item-content', $condition); - logger('Orphaned item content deleted: ' . DBA::affected_rows(), LOGGER_DEBUG); + logger('Orphaned item content deleted: ' . DBA::affectedRows(), LOGGER_DEBUG); // make this optional as it could have a performance impact on large sites if (intval(Config::get('system', 'optimize_items'))) { @@ -68,7 +56,7 @@ class Expire return; } elseif (intval($param) > 0) { $user = DBA::selectFirst('user', ['uid', 'username', 'expire'], ['uid' => $param]); - if (DBM::is_result($user)) { + if (DBA::isResult($user)) { logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - interval: '.$user['expire'], LOGGER_DEBUG); Item::expire($user['uid'], $user['expire']); logger('Expire items for user '.$user['uid'].' ('.$user['username'].') - done ', LOGGER_DEBUG);