diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-06-10 16:59:04 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-06-10 16:59:04 -0700 |
commit | ca870dbf31d31455ab4f5e0f461c5af89e1573fa (patch) | |
tree | 30bf8c1a116828dc0272b5677b717f7721809b3b /mod/channel.php | |
parent | 2128d5a2560383e0d3587087a7dd0aab217bc262 (diff) | |
download | volse-hubzilla-ca870dbf31d31455ab4f5e0f461c5af89e1573fa.tar.gz volse-hubzilla-ca870dbf31d31455ab4f5e0f461c5af89e1573fa.tar.bz2 volse-hubzilla-ca870dbf31d31455ab4f5e0f461c5af89e1573fa.zip |
more work on item table optimisation
Diffstat (limited to 'mod/channel.php')
-rw-r--r-- | mod/channel.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mod/channel.php b/mod/channel.php index 65af36b59..c0f1f419f 100644 --- a/mod/channel.php +++ b/mod/channel.php @@ -145,7 +145,7 @@ function channel_content(&$a, $update = 0, $load = false) { * Get permissions SQL - if $remote_contact is true, our remote user has been pre-verified and we already have fetched his/her groups */ - + $item_normal = item_normal(); $sql_extra = item_permissions_sql($a->profile['profile_uid']); if(get_pconfig($a->profile['profile_uid'],'system','channel_list_mode') && (! $mid)) @@ -165,7 +165,7 @@ function channel_content(&$a, $update = 0, $load = false) { if(($update) && (! $load)) { if ($mid) { - $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0 + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1", dbesc($mid . '%'), intval($a->profile['profile_uid']) @@ -173,7 +173,7 @@ function channel_content(&$a, $update = 0, $load = false) { } else { $r = q("SELECT distinct parent AS `item_id`, created from item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) - WHERE uid = %d AND item_restrict = 0 + WHERE uid = %d $item_normal AND item_wall = 1 AND item_unseen = 1 AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra @@ -207,7 +207,7 @@ function channel_content(&$a, $update = 0, $load = false) { if($load || ($_COOKIE['jsAvailable'] != 1)) { if ($mid) { - $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0 + $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", dbesc($mid), intval($a->profile['profile_uid']) @@ -219,7 +219,7 @@ function channel_content(&$a, $update = 0, $load = false) { } else { $r = q("SELECT distinct id AS item_id, created FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d AND item_restrict = 0 + WHERE uid = %d $item_normal AND item_wall = 1 and item_thread_top = 1 AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null) $sql_extra $sql_extra2 @@ -240,7 +240,7 @@ function channel_content(&$a, $update = 0, $load = false) { $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` - WHERE `item`.`uid` = %d AND `item`.`item_restrict` = 0 + WHERE `item`.`uid` = %d $item_normal AND `item`.`parent` IN ( %s ) $sql_extra ", intval($a->profile['profile_uid']), |