r22956 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22955‎ | r22956 | r22957 >
Date:14:42, 13 June 2007
Author:greg
Status:old
Tags:
Comment:
Use an ORDER BY to enhance randomness
Modified paths:
  • /trunk/extensions/RandomImage/RandomImage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RandomImage/RandomImage.php
@@ -83,7 +83,7 @@
8484 $rand = wfRandom();
8585 $index = $dbr->useIndexClause( 'page_random' );
8686 $sql = "SELECT page_title FROM {$page} {$index} WHERE page_namespace = {$nspc}
87 - AND page_is_redirect = 0 AND page_random > {$rand}";
 87+ AND page_is_redirect = 0 AND page_random > {$rand} ORDER BY page_random LIMIT 1";
8888 $res = $dbr->query( $sql, 'RandomImage::pickImage' );
8989 if( $row = $dbr->fetchObject( $res ) ) {
9090 $ret = Title::makeTitleSafe( $nspc, $row->page_title );

Status & tagging log