aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMax Kostikov <max@kostikov.co>2019-03-25 12:24:36 +0100
committerMax Kostikov <max@kostikov.co>2019-03-25 12:24:36 +0100
commitc218970890c9d522db67dd7f10d700c04c35a61d (patch)
tree45c0584daf64d8bd434f556f133fe36eb1ba33be /include
parentbd27ce252067a8336b7b2e74b0972865867308de (diff)
parent44795b65f946c07fc058bee6fbe1422e5adf7c88 (diff)
downloadvolse-hubzilla-c218970890c9d522db67dd7f10d700c04c35a61d.tar.gz
volse-hubzilla-c218970890c9d522db67dd7f10d700c04c35a61d.tar.bz2
volse-hubzilla-c218970890c9d522db67dd7f10d700c04c35a61d.zip
Merge branch 'duplicate_fixes_1' into 'dev'
if we have an uuid deduplicate by uuid otherwise by mid See merge request hubzilla/core!1573
Diffstat (limited to 'include')
-rwxr-xr-xinclude/items.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/include/items.php b/include/items.php
index c9c2e2d48..c08deb3a0 100755
--- a/include/items.php
+++ b/include/items.php
@@ -1930,11 +1930,21 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
if($parent_deleted)
$arr['item_deleted'] = 1;
- $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($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' 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));
$ret['message'] = 'duplicate post.';