r58053 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58052‎ | r58053 | r58054 >
Date:12:37, 23 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
LiquidThreads updates:
* Fix bug with reply count increment function.
* Make bumping on commitRevision optional (controlled by a parameter)
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Thread.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/Thread.php
@@ -139,12 +139,15 @@
140140 $this->root = null;
141141 }
142142
143 - function commitRevision( $change_type, $change_object = null, $reason = "" ) {
 143+ function commitRevision( $change_type, $change_object = null, $reason = "",
 144+ $bump = null ) {
144145 $this->dieIfHistorical();
145146 global $wgUser;
146147
147148 global $wgThreadActionsNoBump;
148 - $bump = !in_array( $change_type, $wgThreadActionsNoBump );
 149+ if ( is_null($bump) ) {
 150+ $bump = !in_array( $change_type, $wgThreadActionsNoBump );
 151+ }
149152 if ( $bump ) {
150153 $this->sortkey = wfTimestampNow( TS_DB );
151154 }
@@ -376,12 +379,17 @@
377380 }
378381
379382 function incrementReplyCount( $val = 1 ) {
380 - $thread = $this;
381 - while ( $thread ) {
382 - $thread->replyCount += $val;
 383+ $this->replyCount += $val;
 384+
 385+ wfDebug( "Incremented reply count for thread ".$this->id()." to ".$this->replyCount."\n" );
 386+
 387+ $thread = $this->superthread();
 388+
 389+ if ( $thread ) {
 390+ $thread->incrementReplyCount( $val );
 391+ wfDebug( "Saving Incremented thread ".$thread->id().
 392+ " with reply count ".$thread->replyCount."\n" );
383393 $thread->save();
384 -
385 - $thread = $thread->superthread();
386394 }
387395 }
388396

Status & tagging log