don't parse blank ISBNs
[lhc/web/wiklou.git] / includes / SpecialRandompage.php
index 0dd4b60..9282de8 100644 (file)
@@ -1,24 +1,31 @@
 <?php
-# $Id$
+/**
+ * @version # $Id$
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 
-function wfSpecialRandompage()
-{
+/**
+ * Constructor
+ */
+function wfSpecialRandompage() {
        global $wgOut, $wgTitle, $wgArticle, $wgExtraRandompageSQL;
-       $fname = "wfSpecialRandompage";
+       $fname = 'wfSpecialRandompage';
 
-       wfSeedRandom();
        $rand = mt_rand() / mt_getrandmax();
        # interpolation and sprintf() can muck up with locale-specific decimal separator
        $randstr = number_format( $rand, 12, ".", "" );
-       $db =& wfGetDB( DB_READ );
+       $db =& wfGetDB( DB_SLAVE );
        $use_index = $db->useIndexClause( 'cur_random' );
+       $cur = $db->tableName( 'cur' );
+
        if ( $wgExtraRandompageSQL ) {
                $extra = "AND ($wgExtraRandompageSQL)";
        } else {
                $extra = '';
        }
        $sqlget = "SELECT cur_id,cur_title
-               FROM cur $use_index
+               FROM $cur $use_index
                WHERE cur_namespace=0 AND cur_is_redirect=0 $extra
                AND cur_random>$randstr
                ORDER BY cur_random