aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Starling <tstarling@users.mediawiki.org>2004-07-10 01:25:42 +0000
committerTim Starling <tstarling@users.mediawiki.org>2004-07-10 01:25:42 +0000
commitf0987b0523a7552ca92da99e91a3c9eb8d085f00 (patch)
tree039cb3809b6dce42550b09c7e566b2a834920988
parent4bc7a92c566fb1b04a40d85e3f2759a117d04886 (diff)
downloadmediawikicore-f0987b0523a7552ca92da99e91a3c9eb8d085f00.tar.gz
mediawikicore-f0987b0523a7552ca92da99e91a3c9eb8d085f00.zip
exclude Rambot (or any other arbitrary SQL) from Special:Randompage
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/4256
-rw-r--r--includes/DefaultSettings.php4
-rw-r--r--includes/SpecialRandompage.php9
2 files changed, 10 insertions, 3 deletions
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index d4959a7c6ebd..447129412fdb 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -432,7 +432,9 @@ $wgAllowUserJs = true;
# 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;
-
?>
diff --git a/includes/SpecialRandompage.php b/includes/SpecialRandompage.php
index bf6a7fa9a03e..c795670f1d98 100644
--- a/includes/SpecialRandompage.php
+++ b/includes/SpecialRandompage.php
@@ -3,7 +3,7 @@
function wfSpecialRandompage()
{
- global $wgOut, $wgTitle, $wgArticle, $wgIsMySQL;
+ global $wgOut, $wgTitle, $wgArticle, $wgIsMySQL, $wgExtraRandompageSQL;
$fname = "wfSpecialRandompage";
wfSeedRandom();
@@ -11,9 +11,14 @@ function wfSpecialRandompage()
# 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";