Delete of item-content should work now
This commit is contained in:
parent
89f0eec261
commit
6b568bb8fa
|
@ -541,7 +541,8 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
INDEX `contactid_verb` (`contact-id`,`verb`),
|
INDEX `contactid_verb` (`contact-id`,`verb`),
|
||||||
INDEX `deleted_changed` (`deleted`,`changed`),
|
INDEX `deleted_changed` (`deleted`,`changed`),
|
||||||
INDEX `uid_wall_changed` (`uid`,`wall`,`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';
|
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Structure for all posts';
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -1248,6 +1248,7 @@ class DBStructure
|
||||||
"deleted_changed" => ["deleted","changed"],
|
"deleted_changed" => ["deleted","changed"],
|
||||||
"uid_wall_changed" => ["uid","wall","changed"],
|
"uid_wall_changed" => ["uid","wall","changed"],
|
||||||
"uid_eventid" => ["uid","event-id"],
|
"uid_eventid" => ["uid","event-id"],
|
||||||
|
"icid" => ["icid"],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
$database["item-content"] = [
|
$database["item-content"] = [
|
||||||
|
|
|
@ -26,9 +26,12 @@ class Expire {
|
||||||
if ($param == 'delete') {
|
if ($param == 'delete') {
|
||||||
logger('Delete expired items', LOGGER_DEBUG);
|
logger('Delete expired items', LOGGER_DEBUG);
|
||||||
// physically remove anything that has been deleted for more than two months
|
// 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)) {
|
while ($row = dba::fetch($r)) {
|
||||||
dba::delete('item', ['id' => $row['id']]);
|
dba::delete('item', ['id' => $row['id']]);
|
||||||
|
if (!dba::exists('item', ['icid' => $row['icid']])) {
|
||||||
|
dba::delete('item-content', ['id' => $row['icid']]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dba::close($r);
|
dba::close($r);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue