Improved check for duplicates. Improvements with reshared Diaspora items.

This commit is contained in:
Michael Vogel 2015-05-25 19:07:59 +02:00
parent 0c752a2190
commit 7e401ca199
2 changed files with 35 additions and 13 deletions

View file

@ -1351,9 +1351,22 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
dbesc($arr['uri']),
intval($arr['uid'])
);
if($r && count($r)) {
logger('item-store: duplicate item ignored. ' . print_r($arr,true));
logger('duplicated item with the same uri found. ' . print_r($arr,true));
return 0;
} else {
// Check for an existing post with the same content. There seems to be a problem with OStatus.
$r = q("SELECT `id` FROM `item` WHERE `body` = '%s' AND `created` = '%s' AND `contact-id` = %d AND `uid` = %d LIMIT 1",
dbesc($arr['body']),
dbesc($arr['created']),
intval($arr['contact-id']),
intval($arr['uid'])
);
if($r && count($r)) {
logger('duplicated item with the same body found. ' . print_r($arr,true));
return 0;
}
}
// Is this item available in the global items (with uid=0)?