Only fetch items that don't exist in the system
This commit is contained in:
parent
9468b7427d
commit
9dfb9c1c45
1 changed files with 12 additions and 1 deletions
|
@ -476,6 +476,12 @@ class ostatus {
|
||||||
*/
|
*/
|
||||||
private static function processPost($xpath, $entry, &$item, $importer) {
|
private static function processPost($xpath, $entry, &$item, $importer) {
|
||||||
$item["uri"] = $xpath->query('atom:id/text()', $entry)->item(0)->nodeValue;
|
$item["uri"] = $xpath->query('atom:id/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
if (dba::exists('item', array('uid' => $importer["uid"], 'uri' => $item["uri"]))) {
|
||||||
|
logger('Post with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$item["body"] = html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
|
$item["body"] = html2bbcode($xpath->query('atom:content/text()', $entry)->item(0)->nodeValue);
|
||||||
$item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
|
$item["object-type"] = $xpath->query('activity:object-type/text()', $entry)->item(0)->nodeValue;
|
||||||
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
if (($item["object-type"] == ACTIVITY_OBJ_BOOKMARK) || ($item["object-type"] == ACTIVITY_OBJ_EVENT)) {
|
||||||
|
@ -590,7 +596,12 @@ class ostatus {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($item["parent-uri"]) && ($related != '')) {
|
if (isset($item["parent-uri"]) && ($related != '')) {
|
||||||
self::fetchRelated($related, $item["parent-uri"], $importer);
|
if (!dba::exists('item', array('uid' => $importer["uid"], 'uri' => $item['parent-uri']))) {
|
||||||
|
self::fetchRelated($related, $item["parent-uri"], $importer);
|
||||||
|
} else {
|
||||||
|
logger('Reply with URI '.$item["uri"].' already existed for user '.$importer["uid"].'.');
|
||||||
|
}
|
||||||
|
|
||||||
$item["type"] = 'remote-comment';
|
$item["type"] = 'remote-comment';
|
||||||
$item["gravity"] = GRAVITY_COMMENT;
|
$item["gravity"] = GRAVITY_COMMENT;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue