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) {
|
private function fetchThreads($overboard) {
|
||||||
$query = '';
|
$query = '';
|
||||||
$boards = listBoards(true);
|
$boards = listBoards(true);
|
||||||
|
$included_boards = [];
|
||||||
|
|
||||||
foreach ($boards as $b) {
|
foreach ($boards as $b) {
|
||||||
if (in_array($b, $overboard['exclude']))
|
if (in_array($b, $overboard['exclude']))
|
||||||
continue;
|
continue;
|
||||||
|
$included_boards[] = $b;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($included_boards)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($included_boards as $b) {
|
||||||
// Threads are those posts that have no parent thread
|
// Threads are those posts that have no parent thread
|
||||||
$query .= "SELECT *, '$b' AS `board` FROM ``posts_$b`` " .
|
$query .= "SELECT *, '$b' AS `board` FROM ``posts_$b`` WHERE `thread` IS NULL UNION ALL ";
|
||||||
"WHERE `thread` IS NULL UNION ALL ";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);
|
$query = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $query);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue