diff options
author | friendica <info@friendica.com> | 2012-01-02 19:33:26 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-01-02 19:33:26 -0800 |
commit | 0db637bf006ba1869ee72239c7d9964894cdf575 (patch) | |
tree | fa52929072d7a4a3d4ea7a59b974c19c4ed1ee8e /mod | |
parent | 71377291babfb74c238e074a270a3f50679103bf (diff) | |
download | volse-hubzilla-0db637bf006ba1869ee72239c7d9964894cdf575.tar.gz volse-hubzilla-0db637bf006ba1869ee72239c7d9964894cdf575.tar.bz2 volse-hubzilla-0db637bf006ba1869ee72239c7d9964894cdf575.zip |
hopefully this will speed up the network updates a wee bit more
Diffstat (limited to 'mod')
-rw-r--r-- | mod/network.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/mod/network.php b/mod/network.php index b493c419b..397a701da 100644 --- a/mod/network.php +++ b/mod/network.php @@ -263,7 +263,11 @@ function network_content(&$a, $update = 0) { $sql_options = (($star) ? " and starred = 1 " : ''); $sql_options .= (($bmark) ? " and bookmark = 1 " : ''); - $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) "; + // We'll need the following line if starred/bookmarks are allowed in comments in the future + // $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` $sql_options ) "; + + // Otherwise, this is a bit faster: + $sql_extra = $sql_options; if($group) { $r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", @@ -414,7 +418,7 @@ function network_content(&$a, $update = 0) { // Fetch a page full of parent items for this page if($update) { - $r = q("SELECT distinct(`parent`) AS `item_id`, `contact`.`uid` AS `contact_uid` + $r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`unseen` = 1 @@ -442,7 +446,8 @@ function network_content(&$a, $update = 0) { if(count($r)) { foreach($r as $rr) - $parents_arr[] = $rr['item_id']; + if(! array_key_exists($rr['item_id'],$parents_arr)) + $parents_arr[] = $rr['item_id']; $parents_str = implode(', ', $parents_arr); $items = q("SELECT `item`.*, `item`.`id` AS `item_id`, |