query for what we need instead of what we do not need

This commit is contained in:
Mario Vavti 2018-02-22 10:10:46 +01:00
parent a829256bc4
commit bdcee4fc30

View File

@ -4003,18 +4003,24 @@ function zot_feed($uid, $observer_hash, $arr) {
$item_normal = item_normal(); $item_normal = item_normal();
if(is_sys_channel($uid)) { if(is_sys_channel($uid)) {
$r = q("SELECT parent, created, postopts from item
WHERE uid != %d $nonsys_uids = q("SELECT channel_id FROM channel WHERE channel_system = 0");
$item_normal $nonsys_uids_str = ids_to_querystr($nonsys_uids,'channel_id');
$r = q("SELECT parent, postopts FROM item
WHERE uid IN ( %s )
AND item_wall = 1 AND item_wall = 1
and item_private = 0 $sql_extra ORDER BY created ASC $limit", AND item_private = 0
intval($uid) $item_normal
$sql_extra ORDER BY created ASC $limit",
intval($nonsys_uids_str)
); );
} }
else { else {
$r = q("SELECT parent, created, postopts from item $r = q("SELECT parent, postopts FROM item
WHERE uid = %d $item_normal WHERE uid = %d
AND item_wall = 1 AND item_wall = 1
$item_normal
$sql_extra ORDER BY created ASC $limit", $sql_extra ORDER BY created ASC $limit",
intval($uid) intval($uid)
); );