Delete item content for older item records

This commit is contained in:
Michael 2018-06-29 06:51:48 +00:00
parent 4807797eaf
commit a82cf2ae29

View File

@ -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']);