r72703 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r72702‎ | r72703 | r72704 >
Date:05:58, 10 September 2010
Author:werdna
Status:deferred
Tags:
Comment:
Do not include deleted threads in reply counts; reset reply count when it blows out negatively.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Thread.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/Thread.php
@@ -292,6 +292,7 @@
293293
294294 if ( $this->replyCount < -1 ) {
295295 wfWarn( "Saving thread $id with negative reply count {$this->replyCount} " . wfGetAllCallers() );
 296+ $this->replyCount = -1;
296297 }
297298
298299 // Reflect schema changes here.
@@ -773,8 +774,10 @@
774775 $count = 0;
775776
776777 foreach ( $thread->replies() as $reply ) {
777 - $count++;
778 - $count += self::recursiveGetReplyCount( $reply, $level + 1 );
 778+ if ( $thread->type != Threads::TYPE_DELETED ) {
 779+ $count++;
 780+ $count += self::recursiveGetReplyCount( $reply, $level + 1 );
 781+ }
779782 }
780783
781784 return $count;

Status & tagging log