r5251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5250‎ | r5251 | r5252 >
Date:05:36, 17 September 2004
Author:kateturner
Status:old
Tags:
Comment:
Patch from Wil Mahan <wmahan_04 at yahoo.com> to fix a bug where moving a page
left the redirect with cur_random=0, so any new page created in its place never
appeared on Special:Randompage. Fix: calculate cur_random for redirect when
moving page.
Modified paths:
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Title.php
@@ -1101,6 +1101,8 @@
11021102 $dbw =& wfGetDB( DB_MASTER );
11031103 $now = $dbw->timestamp();
11041104 $won = wfInvertTimestamp( wfTimestamp(TS_MW,$now) );
 1105+ wfSeedRandom();
 1106+ $rand = number_format( mt_rand() / mt_getrandmax(), 12, '.', '' );
11051107
11061108 # Rename cur entry
11071109 $dbw->updateArray( 'cur',
@@ -1127,6 +1129,7 @@
11281130 'inverse_timestamp' => $won,
11291131 'cur_touched' => $now,
11301132 'cur_is_redirect' => 1,
 1133+ 'cur_random' => $rand,
11311134 'cur_is_new' => 1,
11321135 'cur_text' => "#REDIRECT [[" . $nt->getPrefixedText() . "]]\n" ), $fname
11331136 );

Status & tagging log