overboards: handle no included boards

This commit is contained in:
Zankaria 2025-02-06 15:11:54 +01:00
parent 2e84ebcbe2
commit 7b691a2330

View file

@ -74,13 +74,21 @@
private function fetchThreads($overboard) {
$query = '';
$boards = listBoards(true);
$included_boards = [];
foreach ($boards as $b) {
if (in_array($b, $overboard['exclude']))
continue;
$included_boards[] = $b;
}
if (empty($included_boards)) {
return [];
}
foreach ($included_boards as $b) {
// Threads are those posts that have no parent thread
$query .= "SELECT *, '$b' AS `board` FROM ``posts_$b`` " .
"WHERE `thread` IS NULL UNION ALL ";
$query .= "SELECT *, '$b' AS `board` FROM ``posts_$b`` WHERE `thread` IS NULL UNION ALL ";
}
$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);