From a82cf2ae29806bcd38cf9607f1be6ff61b0f722d Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 29 Jun 2018 06:51:48 +0000 Subject: [PATCH] Delete item content for older item records --- src/Model/Item.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 8a5264a7b..55e824895 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -750,8 +750,12 @@ class Item extends BaseObject self::deleteTagsFromItem($item); // Set the item to "deleted" - dba::update('item', ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow()], - ['id' => $item['id']]); + // This erasing of item content is superfluous for items with a matching item-content. + // But for the next time we will still have old content in the item table. + $item_fields = ['deleted' => true, 'edited' => DateTimeFormat::utcNow(), 'changed' => DateTimeFormat::utcNow(), + 'body' => '', 'title' => '', 'content-warning' => '', 'rendered-hash' => '', 'rendered-html' => '', + 'object' => '', 'target' => '']; + dba::update('item', $item_fields, ['id' => $item['id']]); Term::insertFromTagFieldByItemId($item['id']); Term::insertFromFileFieldByItemId($item['id']);