diff --git a/html/inc/forum_db.inc b/html/inc/forum_db.inc
index f0143a8201..d794148bee 100644
--- a/html/inc/forum_db.inc
+++ b/html/inc/forum_db.inc
@@ -58,7 +58,7 @@ class BoincThread {
$db = BoincDb::get();
return $db->update($this, 'thread', $clause);
}
- static function enum($clause) {
+ static function enum($clause="") {
$db = BoincDb::get();
return $db->enum('thread', 'BoincThread', $clause);
}
diff --git a/html/ops/forum_repair.php b/html/ops/forum_repair.php
index 31f20f652c..f5a06ad27f 100644
--- a/html/ops/forum_repair.php
+++ b/html/ops/forum_repair.php
@@ -4,6 +4,8 @@
// due to bugs and DB gremlins.
// This script repairs some of them.
+ini_set("memory_limit", "1024M");
+
require_once("../inc/forum_db.inc");
function update_thread_timestamps() {
@@ -36,7 +38,7 @@ function update_user_posts() {
function update_thread_replies() {
$threads = BoincThread::enum();
foreach ($threads as $t) {
- $n = BoincPost::count("thread=$t->id");
+ $n = BoincPost::count("thread=$t->id and hidden=0");
$n--;
if ($t->replies != $n) {
$t->update("replies=$n");