forked from leftypol/leftypol
overboards: handle no included boards
This commit is contained in:
parent
2e84ebcbe2
commit
7b691a2330
1 changed files with 10 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue