1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-25 16:00:22 +01:00

Something is broken. Removed that for now.

This commit is contained in:
Michael Save 2012-09-28 04:53:07 +10:00
parent 9edc856c92
commit 61101dd1f4

View File

@ -973,10 +973,10 @@ function index($page, $mod=false) {
$th['sticky'], $th['locked'], $th['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod $th['sticky'], $th['locked'], $th['sage'], $th['embed'], $mod ? '?/' : $config['root'], $mod
); );
if (!$mod && $config['cache']['enabled'] && $cached_stuff = cache::get("thread_index_{$board['uri']}_{$th['id']}")) { // if (!$mod && $config['cache']['enabled'] && $cached_stuff = cache::get("thread_index_{$board['uri']}_{$th['id']}")) {
$post_count = $cached_stuff[0]; // $post_count = $cached_stuff[0];
$thread->posts = json_decode($cached_stuff[1]); // $thread->posts = json_decode($cached_stuff[1]);
} else { //} else {
$posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri'])); $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(':id', $th['id']);
$posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT); $posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT);
@ -995,7 +995,7 @@ function index($page, $mod=false) {
} }
$post_count = $posts->rowCount(); $post_count = $posts->rowCount();
} //}
if ($post_count == ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) { if ($post_count == ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
$count = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM `posts_%s` WHERE `file` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri'])); $count = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM `posts_%s` WHERE `file` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri']));
@ -1009,8 +1009,8 @@ function index($page, $mod=false) {
$thread->omitted_images = $c['num'] - $num_images; $thread->omitted_images = $c['num'] - $num_images;
} }
if ($config['cache']['enabled']) // if ($config['cache']['enabled'])
cache::set("thread_index_{$board['uri']}_{$th['id']}", json_encode(array($posts->rowCount(), $thread->posts))); // cache::set("thread_index_{$board['uri']}_{$th['id']}", json_encode(array($posts->rowCount(), $thread->posts)));
$thread->posts = array_reverse($thread->posts); $thread->posts = array_reverse($thread->posts);