aboutsummaryrefslogtreecommitdiffstats
path: root/include/items.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-10-03 06:04:17 -0700
committerFriendika <info@friendika.com>2011-10-03 06:04:17 -0700
commitc6ac4387350eefce8ba68485c49ba8da60ff437b (patch)
tree7eb2bd87e59bba237a079b3076553509f62514bc /include/items.php
parente4b4c1e9f8cc00c7cf6dfbffe3c1400cc1e3340f (diff)
downloadvolse-hubzilla-c6ac4387350eefce8ba68485c49ba8da60ff437b.tar.gz
volse-hubzilla-c6ac4387350eefce8ba68485c49ba8da60ff437b.tar.bz2
volse-hubzilla-c6ac4387350eefce8ba68485c49ba8da60ff437b.zip
item_store: prevent storing a duplicate item with same uri+uid
Diffstat (limited to 'include/items.php')
-rw-r--r--include/items.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/items.php b/include/items.php
index 32f0728c3..d907aeddb 100644
--- a/include/items.php
+++ b/include/items.php
@@ -807,6 +807,14 @@ function item_store($arr,$force_parent = false) {
}
}
+ $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+ dbesc($arr['uri']),
+ dbesc($arr['uid'])
+ );
+ if($r && count($r)) {
+ logger('item-store: duplicate item ignored. ' . print_r($arr,true));
+ return 0;
+ }
call_hooks('post_remote',$arr);