Count removed, added logging for iten uri
This commit is contained in:
parent
53a9c65daa
commit
2db7a4971c
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
namespace Friendica\Worker;
|
namespace Friendica\Worker;
|
||||||
|
|
||||||
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
|
|
||||||
class CleanItemUri
|
class CleanItemUri
|
||||||
|
@ -30,8 +31,9 @@ class CleanItemUri
|
||||||
*/
|
*/
|
||||||
public static function execute()
|
public static function execute()
|
||||||
{
|
{
|
||||||
DBA::p("DELETE FROM `item-uri` WHERE NOT `id` IN (SELECT `uri-id` FROM `item`)
|
$ret = DBA::e("DELETE FROM `item-uri` WHERE NOT `id` IN (SELECT `uri-id` FROM `item`)
|
||||||
AND NOT `id` IN (SELECT `parent-uri-id` FROM `item`)
|
AND NOT `id` IN (SELECT `parent-uri-id` FROM `item`)
|
||||||
AND NOT `id` IN (SELECT `thr-parent-id` FROM `item`)");
|
AND NOT `id` IN (SELECT `thr-parent-id` FROM `item`)");
|
||||||
|
Logger::notice('Orphaned URI-ID entries removed', ['result' => $ret, 'rows' => DBA::affectedRows()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class ExpirePosts
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($expire_days)) {
|
if (!empty($expire_days)) {
|
||||||
Logger::notice('Start deleting expired threads', ['expiry_days' => $expire_days, 'count' => DBA::count('item')]);
|
Logger::notice('Start deleting expired threads', ['expiry_days' => $expire_days]);
|
||||||
$ret = DBA::e("DELETE FROM `item-uri` WHERE `id` IN
|
$ret = DBA::e("DELETE FROM `item-uri` WHERE `id` IN
|
||||||
(SELECT `uri-id` FROM `thread`
|
(SELECT `uri-id` FROM `thread`
|
||||||
INNER JOIN `contact` ON `id` = `contact-id` AND NOT `notify_new_posts`
|
INNER JOIN `contact` ON `id` = `contact-id` AND NOT `notify_new_posts`
|
||||||
|
@ -54,20 +54,20 @@ class ExpirePosts
|
||||||
WHERE `uri-id` = `item`.`uri-id`))
|
WHERE `uri-id` = `item`.`uri-id`))
|
||||||
AND `item`.`parent` = `thread`.`iid`))", $expire_days);
|
AND `item`.`parent` = `thread`.`iid`))", $expire_days);
|
||||||
|
|
||||||
Logger::notice('Deleted expired threads', ['result' => $ret, 'rows' => DBA::affectedRows(), 'count' => DBA::count('item')]);
|
Logger::notice('Deleted expired threads', ['result' => $ret, 'rows' => DBA::affectedRows()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($expire_days_unclaimed)) {
|
if (!empty($expire_days_unclaimed)) {
|
||||||
$expiry_date = DateTimeFormat::utc('now - ' . $expire_days_unclaimed . ' days', DateTimeFormat::MYSQL);
|
$expiry_date = DateTimeFormat::utc('now - ' . $expire_days_unclaimed . ' days', DateTimeFormat::MYSQL);
|
||||||
|
|
||||||
Logger::notice('Start deleting unclaimed public items', ['expiry_days' => $expire_days_unclaimed, 'expired' => $expiry_date, 'count' => DBA::count('item')]);
|
Logger::notice('Start deleting unclaimed public items', ['expiry_days' => $expire_days_unclaimed, 'expired' => $expiry_date]);
|
||||||
$ret = DBA::e("DELETE FROM `item-uri` WHERE `id` IN
|
$ret = DBA::e("DELETE FROM `item-uri` WHERE `id` IN
|
||||||
(SELECT `uri-id` FROM `item` WHERE `gravity` = ? AND `uid` = ? AND `received` < ?
|
(SELECT `uri-id` FROM `item` WHERE `gravity` = ? AND `uid` = ? AND `received` < ?
|
||||||
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `item` WHERE `uid` != ?)
|
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `item` WHERE `uid` != ?)
|
||||||
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `item` WHERE `uid` = ? AND `received` > ?))",
|
AND NOT `uri-id` IN (SELECT `parent-uri-id` FROM `item` WHERE `uid` = ? AND `received` > ?))",
|
||||||
GRAVITY_PARENT, 0, $expiry_date, 0, 0, $expiry_date);
|
GRAVITY_PARENT, 0, $expiry_date, 0, 0, $expiry_date);
|
||||||
|
|
||||||
Logger::notice('Deleted unclaimed public items', ['result' => $ret, 'rows' => DBA::affectedRows(), 'count' => DBA::count('item')]);
|
Logger::notice('Deleted unclaimed public items', ['result' => $ret, 'rows' => DBA::affectedRows()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue