diff options
author | Friendika <info@friendika.com> | 2011-10-04 03:06:34 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-04 03:06:34 -0700 |
commit | 07b09300a9aa6f10941b07dd289539b675d1e6ec (patch) | |
tree | 596e07b0597195662edce72e2c528031cb20d38b /include/items.php | |
parent | 3deaafe320e43927f0b784ccbd25b7b8caf001f2 (diff) | |
download | volse-hubzilla-07b09300a9aa6f10941b07dd289539b675d1e6ec.tar.gz volse-hubzilla-07b09300a9aa6f10941b07dd289539b675d1e6ec.tar.bz2 volse-hubzilla-07b09300a9aa6f10941b07dd289539b675d1e6ec.zip |
improve feed import performance
Diffstat (limited to 'include/items.php')
-rw-r--r-- | include/items.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/items.php b/include/items.php index d907aeddb..c8dd4ca42 100644 --- a/include/items.php +++ b/include/items.php @@ -1081,7 +1081,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) { * */ -function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_feed = false) { +function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) { require_once('library/simplepie/simplepie.inc'); @@ -1249,7 +1249,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee // process any deleted entries $del_entries = $feed->get_feed_tags(NAMESPACE_TOMB, 'deleted-entry'); - if(is_array($del_entries) && count($del_entries)) { + if(is_array($del_entries) && count($del_entries) && $pass != 2) { foreach($del_entries as $dentry) { $deleted = false; if(isset($dentry['attribs']['']['ref'])) { @@ -1341,7 +1341,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee $parent_uri = $rawthread[0]['attribs']['']['ref']; } - if(($is_reply) && is_array($contact)) { + if(($is_reply) && is_array($contact) && $pass != 1) { // Have we seen it? If not, import it. @@ -1393,7 +1393,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee } $force_parent = false; - if($contact['network'] === 'stat') { + if($contact['network'] === NETWORK_OSTATUS) { $force_parent = true; if(strlen($datarray['title'])) unset($datarray['title']); @@ -1405,7 +1405,7 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee $datarray['last-child'] = 1; } - if(($contact['network'] === 'feed') || (! strlen($contact['notify']))) { + if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) { // one way feed - no remote comment ability $datarray['last-child'] = 0; } @@ -1438,6 +1438,8 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee $datarray['author-avatar'] = $contact['thumb']; } + // special handling for events + if((x($datarray,'object-type')) && ($datarray['object-type'] === ACTIVITY_OBJ_EVENT)) { $ev = bbtoevent($datarray['body']); if(x($ev,'desc') && x($ev,'start')) { @@ -1511,18 +1513,16 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $secure_fee } - - if(! is_array($contact)) return; - if($contact['network'] === 'stat' || stristr($permalink,'twitter.com')) { + if($contact['network'] === NETWORK_OSTATUS || stristr($permalink,'twitter.com')) { if(strlen($datarray['title'])) unset($datarray['title']); $datarray['last-child'] = 1; } - if(($contact['network'] === 'feed') || (! strlen($contact['notify']))) { + if(($contact['network'] === NETWORK_FEED) || (! strlen($contact['notify']))) { // one way feed - no remote comment ability $datarray['last-child'] = 0; } |