]> git.mxchange.org Git - friendica.git/commitdiff
Delete item content for older item records
authorMichael <heluecht@pirati.ca>
Fri, 29 Jun 2018 06:51:48 +0000 (06:51 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 29 Jun 2018 06:51:48 +0000 (06:51 +0000)
src/Model/Item.php

index 8a5264a7bcd49e4c3a7892d0865686de5feb58e6..55e824895ca74b192c50b0328988318debba9e2b 100644 (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']);