]> git.mxchange.org Git - friendica.git/commitdiff
item_store: prevent storing a duplicate item with same uri+uid
authorFriendika <info@friendika.com>
Mon, 3 Oct 2011 13:04:17 +0000 (06:04 -0700)
committerFriendika <info@friendika.com>
Mon, 3 Oct 2011 13:04:17 +0000 (06:04 -0700)
include/items.php

index 32f0728c33fa5b16f9119477c20be8815ed59079..d907aeddba21ed9bb59636e805a1b7aa1685bdd2 100644 (file)
@@ -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);