summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorczaks <marcin@6irc.net>2015-04-06 18:59:33 +0200
committerczaks <marcin@6irc.net>2015-04-06 18:59:33 +0200
commit094f60d34dce0d639b04ef28d5719e22551db288 (patch)
treef9d6d75c1247d95129aa2812a78356fa94ce1cf2
parent64a0b486f2dd49a749104eb200127208f7b592df (diff)
try_smarter: fix two bugs. 1. uncovered by the second, during a bump only the page the thread was on and first page were rebuild, despite threads rearranging their positions on the remaining pages. happening always. 2. during smart build, the page wasn`t ordered to be rebuilt
-rwxr-xr-xinc/functions.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/inc/functions.php b/inc/functions.php
index 676f5b68..a6c85a19 100755
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -1104,8 +1104,9 @@ function bumpThread($id) {
if (event('bump', $id))
return true;
- if ($config['try_smarter'])
- $build_pages[] = thread_find_page($id);
+ if ($config['try_smarter']) {
+ $build_pages = array_merge(range(1, thread_find_page($id)), $build_pages);
+ }
$query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri']));
$query->bindValue(':time', time(), PDO::PARAM_INT);
@@ -2146,6 +2147,9 @@ function buildThread($id, $return = false, $mod = false) {
cache::delete("thread_{$board['uri']}_{$id}");
}
+ if ($config['try_smarter'] && !$mod)
+ $build_pages[] = thread_find_page($id);
+
if (!$config['smart_build'] || $return || $mod) {
$query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri']));
$query->bindValue(':id', $id, PDO::PARAM_INT);
@@ -2180,9 +2184,6 @@ function buildThread($id, $return = false, $mod = false) {
'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index'])
));
- if ($config['try_smarter'] && !$mod)
- $build_pages[] = thread_find_page($id);
-
// json api
if ($config['api']['enabled']) {
$api = new Api();