From 680cf25f37348d2da978196554e07f1694475763 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 24 Nov 2022 16:08:57 +0100 Subject: de-duplicate by mid. there is no combined index for uid and uuid hence the query could be slow if an uid has a lot of items. the workaround for hubzilla < 4.0 is not required anymore --- include/items.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'include/items.php') diff --git a/include/items.php b/include/items.php index 0f477e761..b414928fd 100644 --- a/include/items.php +++ b/include/items.php @@ -1848,21 +1848,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { if($parent_deleted) $arr['item_deleted'] = 1; - if($arr['uuid']) { - $r = q("SELECT id FROM item WHERE uuid = '%s' AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['uuid']), - intval($arr['uid']), - intval($arr['revision']) - ); - } - else { - $r = q("SELECT id FROM item WHERE (mid = '%s' OR mid = '%s') AND uid = %d and revision = %d LIMIT 1", - dbesc($arr['mid']), - dbesc(basename(rawurldecode($arr['mid']))), // de-duplicate relayed comments from hubzilla < 4.0 - intval($arr['uid']), - intval($arr['revision']) - ); - } + $r = q("SELECT id FROM item WHERE mid = '%s' AND uid = %d and revision = %d LIMIT 1", + dbesc($arr['mid']), + intval($arr['uid']), + intval($arr['revision']) + ); if($r) { logger('duplicate item ignored. ' . print_r($arr,true)); -- cgit v1.2.3