r57524 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r57523‎ | r57524 | r57525 >
Date:16:31, 8 October 2009
Author:werdna
Status:deferred
Tags:
Comment:
Sortkey adjustments.
* Fix issue where updated sortkey was not being saved on topmost thread.
* Use TS_DB consistently for sort-key.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Thread.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/Thread.php
@@ -135,8 +135,9 @@
136136 global $wgUser;
137137
138138 global $wgThreadActionsNoBump;
139 - if ( !in_array( $change_type, $wgThreadActionsNoBump ) ) {
140 - $this->sortkey = wfTimestampNow();
 139+ $bump = !in_array( $change_type, $wgThreadActionsNoBump );
 140+ if ( $bump ) {
 141+ $this->sortkey = wfTimestampNow( TS_DB );
141142 }
142143
143144 $this->modified = wfTimestampNow();
@@ -145,6 +146,7 @@
146147
147148 $topmost = $this->topmostThread();
148149 $topmost->modified = wfTimestampNow();
 150+ if ( $bump ) $topmost->setSortkey( wfTimestampNow( TS_DB ) );
149151 $topmost->save();
150152
151153 ThreadRevision::create( $this, $change_type, $change_object, $reason );
@@ -352,7 +354,7 @@
353355 $dbr = wfGetDB( DB_SLAVE );
354356 $this->modified = $dbr->timestamp( wfTimestampNow() );
355357 $this->created = $dbr->timestamp( wfTimestampNow() );
356 - $this->sortkey = $dbr->timestamp( wfTimestampNow() );
 358+ $this->sortkey = wfTimestampNow( TS_DB );
357359 $this->editedness = Threads::EDITED_NEVER;
358360 $this->replyCount = 0;
359361 return;
@@ -1175,7 +1177,7 @@
11761178 function setSortKey( $k = null ) {
11771179 if ( is_null($k) ) {
11781180 $dbr = wfGetDB( DB_SLAVE );
1179 - $k = $dbr->timestamp( wfTimestampNow() );
 1181+ $k = wfTimestampNow( TS_DB );
11801182 }
11811183
11821184 $this->sortkey = $k;

Follow-up revisions

RevisionCommit summaryAuthorDate
r57525Merge r57524werdna16:33, 8 October 2009

Status & tagging log