MediaWiki r4256 - Code Review

Jump to: navigation, search
Repository:MediaWiki
Revision:r4255‎ | r4256 (on ViewVC)‎ | r4257 >
Date:01:25, 10 July 2004
Author:timstarling
Status:old
Tags:
Comment:
exclude Rambot (or any other arbitrary SQL) from Special:Randompage
Modified paths:

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
===================================================================
--- trunk/phase3/includes/DefaultSettings.php	(revision 4255)
+++ trunk/phase3/includes/DefaultSettings.php	(revision 4256)
@@ -432,7 +432,9 @@
 # Allow user Cascading Style Sheets (CSS)?
 $wgAllowUserCss = true;
 
+# Filter for Special:Randompage. Part of a WHERE clause
+$wgExtraRandompageSQL = false;
+
 # Allow the "info" action, very inefficient at the moment
 $wgAllowPageInfo = false;
-
 ?>
Index: trunk/phase3/includes/SpecialRandompage.php
===================================================================
--- trunk/phase3/includes/SpecialRandompage.php	(revision 4255)
+++ trunk/phase3/includes/SpecialRandompage.php	(revision 4256)
@@ -3,7 +3,7 @@
 
 function wfSpecialRandompage()
 {
-	global $wgOut, $wgTitle, $wgArticle, $wgIsMySQL;
+	global $wgOut, $wgTitle, $wgArticle, $wgIsMySQL, $wgExtraRandompageSQL;
 	$fname = "wfSpecialRandompage";
 
 	wfSeedRandom();
@@ -11,9 +11,14 @@
 	# interpolation and sprintf() can muck up with locale-specific decimal separator
 	$randstr = number_format( $rand, 12, ".", "" );
 	$use_index=$wgIsMySQL?"USE INDEX (cur_random)":"";
+	if ( $wgExtraRandompageSQL ) {
+		$extra = "AND ($wgExtraRandompageSQL)";
+	} else {
+		$extra = '';
+	}
 	$sqlget = "SELECT cur_id,cur_title
 		FROM cur $use_index
-		WHERE cur_namespace=0 AND cur_is_redirect=0
+		WHERE cur_namespace=0 AND cur_is_redirect=0 $extra
 		AND cur_random>$randstr
 		ORDER BY cur_random
 		LIMIT 1";

Status & tagging log

  • 01:56, 13 October 2010 ^demon (Talk | contribs) changed the status of r4256 [removed: new added: old]
Personal tools
Namespaces
Variants
Views
Actions
Site
Support
Download
Development
Communication
Toolbox