From 562128b02bb66a7b1bc3338e61d1e839069edc3b Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Wed, 27 Sep 2023 18:43:14 -0700 Subject: [PATCH] tq: use MAX for mimetype query (fix #312) Signed-off-by: Varun Patil --- lib/Db/TimelineQueryCTE.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Db/TimelineQueryCTE.php b/lib/Db/TimelineQueryCTE.php index ac0680001..095d5ec80 100644 --- a/lib/Db/TimelineQueryCTE.php +++ b/lib/Db/TimelineQueryCTE.php @@ -19,7 +19,7 @@ protected static function CTE_FOLDERS_ALL(bool $noHidden): string $CLS_HIDDEN_JOIN = $noHidden ? "f.name NOT LIKE '.%'" : '1 = 1'; // Filter out folder MIME types - $CLS_MIME_FOLDER = "f.mimetype = (SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = 'httpd/unix-directory')"; + $FOLDER_MIME_QUERY = "SELECT MAX(id) FROM *PREFIX*mimetypes WHERE mimetype = 'httpd/unix-directory'"; // Select filecache as f $BASE_QUERY = 'SELECT f.fileid, f.name FROM *PREFIX*filecache f'; @@ -49,7 +49,7 @@ protected static function CTE_FOLDERS_ALL(bool $noHidden): string INNER JOIN *PREFIX*cte_folders_all c ON ( f.parent = c.fileid AND - {$CLS_MIME_FOLDER} AND + f.mimetype = ({$FOLDER_MIME_QUERY}) AND {$CLS_HIDDEN_JOIN} ) WHERE (