Add guid context to item deletion logging
This commit is contained in:
parent
6ae5f705b6
commit
86a6268aac
4 changed files with 12 additions and 12 deletions
|
@ -1938,7 +1938,7 @@ class Item
|
|||
|
||||
if ($entries > 1) {
|
||||
// There are duplicates. We delete our just created entry.
|
||||
Logger::notice('Delete duplicated item', ['id' => $current_post, 'uri' => $item['uri'], 'uid' => $item['uid']]);
|
||||
Logger::notice('Delete duplicated item', ['id' => $current_post, 'uri' => $item['uri'], 'uid' => $item['uid'], 'guid' => $item['guid']]);
|
||||
|
||||
// Yes, we could do a rollback here - but we are having many users with MyISAM.
|
||||
DBA::delete('item', ['id' => $current_post]);
|
||||
|
@ -2721,7 +2721,7 @@ class Item
|
|||
if (!$mention) {
|
||||
if (($community_page || $prvgroup) &&
|
||||
!$item['wall'] && !$item['origin'] && ($item['id'] == $item['parent'])) {
|
||||
Logger::notice('Delete private group/communiy top-level item without mention', ['id' => $item_id]);
|
||||
Logger::notice('Delete private group/communiy top-level item without mention', ['id' => $item_id, 'guid'=> $item['guid']]);
|
||||
DBA::delete('item', ['id' => $item_id]);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ class DBClean {
|
|||
$last_id = DI::config()->get('system', 'dbclean-last-id-1', 0);
|
||||
|
||||
Logger::log("Deleting old global item entries from item table without user copy. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id`, `guid` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL ? DAY AND `id` >= ?
|
||||
ORDER BY `id` LIMIT ?", $days_unclaimed, $last_id, $limit);
|
||||
|
@ -107,7 +107,7 @@ class DBClean {
|
|||
Logger::log("found global item orphans: ".$count);
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
Logger::notice('Delete global orphan item', ['id' => $orphan["id"]]);
|
||||
Logger::notice('Delete global orphan item', ['id' => $orphan['id'], 'guid' => $orphan['guid']]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 1, $last_id);
|
||||
|
@ -122,7 +122,7 @@ class DBClean {
|
|||
$last_id = DI::config()->get('system', 'dbclean-last-id-2', 0);
|
||||
|
||||
Logger::log("Deleting items without parents. Last ID: ".$last_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item`
|
||||
$r = DBA::p("SELECT `id`, `guid` FROM `item`
|
||||
WHERE NOT EXISTS (SELECT `id` FROM `item` AS `i` WHERE `item`.`parent` = `i`.`id`)
|
||||
AND `id` >= ? ORDER BY `id` LIMIT ?", $last_id, $limit);
|
||||
$count = DBA::numRows($r);
|
||||
|
@ -130,7 +130,7 @@ class DBClean {
|
|||
Logger::log("found item orphans without parents: ".$count);
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
Logger::notice('Delete orphan item', ['id' => $orphan["id"]]);
|
||||
Logger::notice('Delete orphan item', ['id' => $orphan['id'], 'guid' => $orphan['guid']]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 2, $last_id);
|
||||
|
@ -319,7 +319,7 @@ class DBClean {
|
|||
$till_id = DI::config()->get('system', 'dbclean-last-id-8', 0);
|
||||
|
||||
Logger::log("Deleting old global item entries from expired threads from ID ".$last_id." to ID ".$till_id);
|
||||
$r = DBA::p("SELECT `id` FROM `item` WHERE `uid` = 0 AND
|
||||
$r = DBA::p("SELECT `id`, `guid` FROM `item` WHERE `uid` = 0 AND
|
||||
NOT EXISTS (SELECT `guid` FROM `item` AS `i` WHERE `item`.`guid` = `i`.`guid` AND `i`.`uid` != 0) AND
|
||||
`received` < UTC_TIMESTAMP() - INTERVAL 90 DAY AND `id` >= ? AND `id` <= ?
|
||||
ORDER BY `id` LIMIT ?", $last_id, $till_id, $limit);
|
||||
|
@ -328,7 +328,7 @@ class DBClean {
|
|||
Logger::log("found global item entries from expired threads: ".$count);
|
||||
while ($orphan = DBA::fetch($r)) {
|
||||
$last_id = $orphan["id"];
|
||||
Logger::notice('Delete expired thread item', ['id' => $orphan["id"]]);
|
||||
Logger::notice('Delete expired thread item', ['id' => $orphan['id'], 'guid' => $orphan['guid']]);
|
||||
DBA::delete('item', ['id' => $orphan["id"]]);
|
||||
}
|
||||
Worker::add(PRIORITY_MEDIUM, 'DBClean', 9, $last_id);
|
||||
|
|
|
@ -43,9 +43,9 @@ class Expire
|
|||
Logger::log('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'], $condition);
|
||||
$rows = DBA::select('item', ['id', 'guid'], $condition);
|
||||
while ($row = DBA::fetch($rows)) {
|
||||
Logger::notice('Delete expired item', ['id' => $row["id"]]);
|
||||
Logger::notice('Delete expired item', ['id' => $row['id'], 'guid' => $row['guid']]);
|
||||
DBA::delete('item', ['id' => $row['id']]);
|
||||
}
|
||||
DBA::close($rows);
|
||||
|
|
|
@ -41,9 +41,9 @@ class RemoveContact {
|
|||
// Now we delete the contact and all depending tables
|
||||
$condition = ['uid' => $contact['uid'], 'contact-id' => $id];
|
||||
do {
|
||||
$items = Item::select(['id'], $condition, ['limit' => 100]);
|
||||
$items = Item::select(['id', 'guid'], $condition, ['limit' => 100]);
|
||||
while ($item = Item::fetch($items)) {
|
||||
Logger::notice('Delete removed contact item', ['id' => $item["id"]]);
|
||||
Logger::notice('Delete removed contact item', ['id' => $item['id'], 'guid' => $item['guid']]);
|
||||
DBA::delete('item', ['id' => $item['id']]);
|
||||
}
|
||||
DBA::close($items);
|
||||
|
|
Loading…
Reference in a new issue