Adds limit to overboard catalog
This commit is contained in:
parent
5b57d35a4c
commit
a3e2af403b
|
@ -97,6 +97,13 @@
|
|||
'default' => 'overboard',
|
||||
'comment' => 'Fill in the location of the overboard directory. Default is \'overboard\' which corresponds to ./overboard'
|
||||
);
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Max posts in catalog overboard',
|
||||
'name' => 'overboard_limit',
|
||||
'type' => 'text',
|
||||
'default' => '350',
|
||||
'comment' => 'The maximum number of thread that will appear in the overboard catalog'
|
||||
);
|
||||
|
||||
// Unique function name for building everything
|
||||
$theme['build_function'] = 'catalog_build';
|
||||
|
|
|
@ -357,12 +357,15 @@
|
|||
} else {
|
||||
$sql = '';
|
||||
foreach ($boards as $board) {
|
||||
$sql .= $this->buildThreadsQuery($board);
|
||||
$sql .= '('. $this->buildThreadsQuery($board) . ')';
|
||||
$sql .= " UNION ALL ";
|
||||
}
|
||||
$sql = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC', $sql);
|
||||
$result = query($sql) or error(db_error());
|
||||
$threads = $result->fetchAll(PDO::FETCH_ASSOC);
|
||||
$sql = preg_replace('/UNION ALL $/', 'ORDER BY `bump` DESC LIMIT :limit', $sql);
|
||||
$query = prepare($sql);
|
||||
$query->bindValue(':limit', $settings['overboard_limit'], PDO::PARAM_INT);
|
||||
$query->execute() or error(db_error($query));
|
||||
|
||||
$threads = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
// Save for posterity
|
||||
$this->threadsCache[$board_name] = $threads;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue