From 36e443e07d360f777c2848122645db8b30873e66 Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 20 Jan 2012 03:12:48 +0000 Subject: [PATCH] the algorithm for listing old comments pages is *really* inefficient; the first few pages are quick, page 100 can take a few seconds to generate... rule34 has over 100,000 pages of comments. Limit to the first few pages for now, as I don't know anyone who even goes past the front page. --- ext/comment/main.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 6f082a76..c71ebc2a 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -146,7 +146,18 @@ class CommentList extends SimpleExtension { } } else if($event->get_arg(0) == "list") { - $this->build_page($event->get_arg(1)); + $page_num = int_escape($event->get_arg(1)); + if($page_num <= 5) { + $this->build_page($page_num); + } + else { + header("HTTP/1.0 403 Blocked"); + $this->theme->display_error($page, + "This page is history~", + "Only the first 5 pages of comments are visible ". + "- 99% of the traffic to older pages was bots, and ". + "they were hammering the database o.o"); + } } } }