Patch from Wil Mahan <wmahan_04 at yahoo.com> to fix a bug where moving a page
authorRiver Tarnell <kateturner@users.mediawiki.org>
Fri, 17 Sep 2004 05:36:59 +0000 (05:36 +0000)
committerRiver Tarnell <kateturner@users.mediawiki.org>
Fri, 17 Sep 2004 05:36:59 +0000 (05:36 +0000)
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.

includes/Title.php

index 3505184..40d2de7 100644 (file)
@@ -1101,6 +1101,8 @@ class Title {
                $dbw =& wfGetDB( DB_MASTER );
                $now = $dbw->timestamp();
                $won = wfInvertTimestamp( wfTimestamp(TS_MW,$now) );
+               wfSeedRandom();
+               $rand = number_format( mt_rand() / mt_getrandmax(), 12, '.', '' );
 
                # Rename cur entry
                $dbw->updateArray( 'cur',
@@ -1127,6 +1129,7 @@ class Title {
                        'inverse_timestamp' => $won,
                        'cur_touched' => $now,
                        'cur_is_redirect' => 1,
+                       'cur_random' => $rand,
                        'cur_is_new' => 1,
                        'cur_text' => "#REDIRECT [[" . $nt->getPrefixedText() . "]]\n" ), $fname
                );