From ca870dbf31d31455ab4f5e0f461c5af89e1573fa Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 10 Jun 2015 16:59:04 -0700 Subject: more work on item table optimisation --- mod/display.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'mod/display.php') diff --git a/mod/display.php b/mod/display.php index 33fb83e70..2f61e688a 100644 --- a/mod/display.php +++ b/mod/display.php @@ -157,6 +157,7 @@ function display_content(&$a, $update = 0, $load = false) { } $observer_hash = get_observer_hash(); + $item_normal = item_normal(); $sql_extra = public_permissions_sql($observer_hash); @@ -175,9 +176,9 @@ function display_content(&$a, $update = 0, $load = false) { if(local_channel()) { $r = q("SELECT * from item - WHERE item_restrict = 0 - and uid = %d + WHERE uid = %d and mid = '%s' + $item_normal limit 1", intval(local_channel()), dbesc($target_item['parent_mid']) @@ -198,13 +199,13 @@ function display_content(&$a, $update = 0, $load = false) { $r = q("SELECT * from item - WHERE item_restrict = 0 - and mid = '%s' + WHERE mid = '%s' AND (((( `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' AND item_private = 0 ) and owner_xchan in ( " . stream_perms_xchans(($observer_hash) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) OR uid = %d ) $sql_extra ) + $item_normal limit 1", dbesc($target_item['parent_mid']), intval($sysid) @@ -224,7 +225,7 @@ function display_content(&$a, $update = 0, $load = false) { $items = q("SELECT `item`.*, `item`.`id` AS `item_id` FROM `item` - WHERE item_restrict = 0 and parent in ( %s ) ", + WHERE parent in ( %s ) $item_normal ", dbesc($parents_str) ); -- cgit v1.2.3