From: Diogo Cordeiro Date: Tue, 23 Apr 2019 22:10:43 +0000 (+0100) Subject: inboxnoticestream.php gotta go fast X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5dcc98d1c6;p=quix0rs-gnu-social.git inboxnoticestream.php gotta go fast --- diff --git a/lib/inboxnoticestream.php b/lib/inboxnoticestream.php index 7d28a3e441..3cf5d905ff 100644 --- a/lib/inboxnoticestream.php +++ b/lib/inboxnoticestream.php @@ -5,8 +5,6 @@ * * Stream of notices for a profile's "all" feed * - * PHP version 5 - * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or @@ -138,6 +136,14 @@ class RawInboxNoticeStream extends FullNoticeStream ); $notice_ids += $group_inbox->fetchAll('notice_id'); + // This is just to make the query lighter when processed by the Database server + $notice_ids = array_filter($notice_ids, function ($id) { + // Keep id (a.k.a.: return true) if: + // - id higher than since id (just constrain if specified) + // - id lower than max id (just constrain if specified) + return (empty($since_id) || $id > $since_id) && (empty($max_id) || $id <= $max_id); + }); + $query_ids = ''; if (!empty($notice_ids)) { // Replies, Attentions and Groups