]> git.mxchange.org Git - friendica.git/commitdiff
Delete of item-content should work now
authorMichael <heluecht@pirati.ca>
Mon, 25 Jun 2018 20:23:32 +0000 (20:23 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 25 Jun 2018 20:23:32 +0000 (20:23 +0000)
database.sql
src/Database/DBStructure.php
src/Worker/Expire.php

index cca1163145d2e6208889598f4ed1f3d5d4096ef5..9711ace803eed6a73dee7c4bbf3d1e64a7029d9c 100644 (file)
@@ -541,7 +541,8 @@ CREATE TABLE IF NOT EXISTS `item` (
         INDEX `contactid_verb` (`contact-id`,`verb`),
         INDEX `deleted_changed` (`deleted`,`changed`),
         INDEX `uid_wall_changed` (`uid`,`wall`,`changed`),
-        INDEX `uid_eventid` (`uid`,`event-id`)
+        INDEX `uid_eventid` (`uid`,`event-id`),
+        INDEX `icid` (`icid`)
 ) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
 
 --
index e6bbf220948b6c43606f425da2531cb1eb9e7f46..eaf54cee233aeac8d1d61c8a9cb39dd5ac0c9332 100644 (file)
@@ -1248,6 +1248,7 @@ class DBStructure
                                                "deleted_changed" => ["deleted","changed"],
                                                "uid_wall_changed" => ["uid","wall","changed"],
                                                "uid_eventid" => ["uid","event-id"],
+                                               "icid" => ["icid"],
                                                ]
                                ];
                $database["item-content"] = [
index cf6e78cb7203d05618a246d6b25b4b61b550905e..713bfa25e0ad67f6a6f9caab456ba5de7375dffd 100644 (file)
@@ -26,9 +26,12 @@ class Expire {
                if ($param == 'delete') {
                        logger('Delete expired items', LOGGER_DEBUG);
                        // physically remove anything that has been deleted for more than two months
-                       $r = dba::p("SELECT `id` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
+                       $r = dba::p("SELECT `id`, `icid` FROM `item` WHERE `deleted` AND `changed` < UTC_TIMESTAMP() - INTERVAL 60 DAY");
                        while ($row = dba::fetch($r)) {
                                dba::delete('item', ['id' => $row['id']]);
+                               if (!dba::exists('item', ['icid' => $row['icid']])) {
+                                       dba::delete('item-content', ['id' => $row['icid']]);
+                               }
                        }
                        dba::close($r);