Skip to content

Commit

Permalink
tq: use MAX for mimetype query (fix #312)
Browse files Browse the repository at this point in the history
Signed-off-by: Varun Patil <[email protected]>
  • Loading branch information
pulsejet committed Sep 28, 2023
1 parent 1c51422 commit 562128b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Db/TimelineQueryCTE.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
Expand Down

0 comments on commit 562128b

Please sign in to comment.