tq: use MAX for mimetype query (fix #312)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/837/head
Varun Patil 2023-09-27 18:43:14 -07:00
parent 1c51422ed9
commit 562128b02b
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ trait TimelineQueryCTE
$CLS_HIDDEN_JOIN = $noHidden ? "f.name NOT LIKE '.%'" : '1 = 1'; $CLS_HIDDEN_JOIN = $noHidden ? "f.name NOT LIKE '.%'" : '1 = 1';
// Filter out folder MIME types // 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 // Select filecache as f
$BASE_QUERY = 'SELECT f.fileid, f.name FROM *PREFIX*filecache f'; $BASE_QUERY = 'SELECT f.fileid, f.name FROM *PREFIX*filecache f';
@ -49,7 +49,7 @@ trait TimelineQueryCTE
INNER JOIN *PREFIX*cte_folders_all c INNER JOIN *PREFIX*cte_folders_all c
ON ( ON (
f.parent = c.fileid AND f.parent = c.fileid AND
{$CLS_MIME_FOLDER} AND f.mimetype = ({$FOLDER_MIME_QUERY}) AND
{$CLS_HIDDEN_JOIN} {$CLS_HIDDEN_JOIN}
) )
WHERE ( WHERE (