diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-08 13:35:02 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-09-08 13:35:02 +1000 |
| commit | d80af7d077a1a5446c188e3338aa7035f78a43d2 (patch) | |
| tree | 81cf363a64c0255a6ce3d57af02640e8f70029a3 /inc | |
| parent | 0e23a6a2b43ccb388e7fcc62d5d73890c5bef019 (diff) | |
Bugfix: Sometimes caching here fucks up. Not really sure why yet.
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/functions.php | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/inc/functions.php b/inc/functions.php index ba1b04c8..819a935b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1067,10 +1067,16 @@ function index($page, $mod=false) { while ($th = $query->fetch(PDO::FETCH_ASSOC)) { $thread = new Thread($th, $mod ? '?/' : $config['root'], $mod); - if ($config['cache']['enabled'] && $cached = cache::get("thread_index_{$board['uri']}_{$th['id']}")) { - $replies = $cached['replies']; - $omitted = $cached['omitted']; - } else { + if ($config['cache']['enabled']) { + $cached = cache::get("thread_index_{$board['uri']}_{$th['id']}"); + if (isset($cached['replies'], $cached['omitted'])) { + $replies = $cached['replies']; + $omitted = $cached['omitted']; + } else { + $cached = false; + } + } + if (!$cached) { $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri'])); $posts->bindValue(':id', $th['id']); $posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT); |
