aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2022-11-24 16:08:57 +0100
committerMario Vavti <mario@mariovavti.com>2022-11-24 16:08:57 +0100
commit680cf25f37348d2da978196554e07f1694475763 (patch)
tree4c6a263e4ac825cb0e1aba45c2a59f8c431fc984 /include/items.php
parent7ec6df495f5e740b16d7bdca89b18a3f6bc78c80 (diff)
downloadvolse-hubzilla-680cf25f37348d2da978196554e07f1694475763.tar.gz
volse-hubzilla-680cf25f37348d2da978196554e07f1694475763.tar.bz2
volse-hubzilla-680cf25f37348d2da978196554e07f1694475763.zip
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
Diffstat (limited to 'include/items.php')
-rw-r--r--include/items.php20
1 files changed, 5 insertions, 15 deletions
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));