mirror of
https://github.com/friendica/friendica
synced 2025-04-26 18:30:11 +00:00
Rewrite:
- moved constants GRAVITY_* from boot.php to Friendica\Model\Item - also rewrote some array initialization: From: ```` <?php $arr = []; $arr['foo'] = "FOO"; ```` To: ```` <?php $arr['foo'] = "FOO"; ```` - added a few type-hints
This commit is contained in:
parent
e5ae5c7e67
commit
da66730e4f
77 changed files with 547 additions and 513 deletions
|
@ -68,7 +68,7 @@ class ExpirePosts
|
|||
{
|
||||
Logger::notice('Delete expired posts');
|
||||
// physically remove anything that has been deleted for more than two months
|
||||
$condition = ["`gravity` = ? AND `deleted` AND `changed` < ?", GRAVITY_PARENT, DateTimeFormat::utc('now - 60 days')];
|
||||
$condition = ["`gravity` = ? AND `deleted` AND `changed` < ?", Item::GRAVITY_PARENT, DateTimeFormat::utc('now - 60 days')];
|
||||
$rows = Post::select(['guid', 'uri-id', 'uid'], $condition);
|
||||
while ($row = Post::fetch($rows)) {
|
||||
Logger::info('Delete expired item', ['uri-id' => $row['uri-id'], 'guid' => $row['guid']]);
|
||||
|
@ -134,7 +134,7 @@ class ExpirePosts
|
|||
}
|
||||
|
||||
$rows = 0;
|
||||
$userposts = DBA::select('post-user', [], ["`gravity` = ? AND `uri-id` not in (select `uri-id` from `post-thread`)", GRAVITY_PARENT]);
|
||||
$userposts = DBA::select('post-user', [], ["`gravity` = ? AND `uri-id` not in (select `uri-id` from `post-thread`)", Item::GRAVITY_PARENT]);
|
||||
while ($fields = DBA::fetch($userposts)) {
|
||||
$post_fields = DI::dbaDefinition()->truncateFieldsForTable('post-thread', $fields);
|
||||
$post_fields['commented'] = $post_fields['changed'] = $post_fields['created'];
|
||||
|
@ -149,7 +149,7 @@ class ExpirePosts
|
|||
}
|
||||
|
||||
$rows = 0;
|
||||
$userposts = DBA::select('post-user', [], ["`gravity` = ? AND `id` not in (select `post-user-id` from `post-thread-user`)", GRAVITY_PARENT]);
|
||||
$userposts = DBA::select('post-user', [], ["`gravity` = ? AND `id` not in (select `post-user-id` from `post-thread-user`)", Item::GRAVITY_PARENT]);
|
||||
while ($fields = DBA::fetch($userposts)) {
|
||||
$post_fields = DI::dbaDefinition()->truncateFieldsForTable('post-thread-user', $fields);
|
||||
$post_fields['commented'] = $post_fields['changed'] = $post_fields['created'];
|
||||
|
@ -264,7 +264,7 @@ class ExpirePosts
|
|||
AND `i`.`parent-uri-id` = `post-user`.`uri-id`)
|
||||
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `post-user` AS `i` WHERE `i`.`uid` = ?
|
||||
AND `i`.`parent-uri-id` = `post-user`.`uri-id` AND `i`.`received` > ?))",
|
||||
GRAVITY_PARENT, 0, DateTimeFormat::utc('now - ' . (int)$expire_days_unclaimed . ' days'), 0, 0, DateTimeFormat::utc('now - ' . (int)$expire_days_unclaimed . ' days')]);
|
||||
Item::GRAVITY_PARENT, 0, DateTimeFormat::utc('now - ' . (int)$expire_days_unclaimed . ' days'), 0, 0, DateTimeFormat::utc('now - ' . (int)$expire_days_unclaimed . ' days')]);
|
||||
|
||||
Logger::notice('Start deleting unclaimed public items');
|
||||
$affected_count = 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue