(bug 19833) Make the searching-for-an-IP-means-you-want-Special:Contributions behavio...
authorRoan Kattouw <catrope@users.mediawiki.org>
Mon, 14 Nov 2011 20:00:35 +0000 (20:00 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Mon, 14 Nov 2011 20:00:35 +0000 (20:00 +0000)
CREDITS
RELEASE-NOTES-1.19
includes/DefaultSettings.php
includes/search/SearchEngine.php

diff --git a/CREDITS b/CREDITS
index d6677dc..4e559f2 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -145,6 +145,7 @@ following names for their contribution to the product.
 * Nx.devnull
 * Nikolaos S. Karastathis
 * Olaf Lenz
+* Olivier Finlay Beaton
 * Paul Copperman
 * Paul Oranje
 * PieRRoMaN
index acdaff6..1fd3603 100644 (file)
@@ -81,6 +81,8 @@ production.
 * (bug 30062) Add $wgDBprefix option to cli installer
 * getUserPermissionsErrors and getUserPermissionsErrorsExpensive hooks are now
   also called when checking for 'read' permission
+* Introduce $wgEnableSearchContributorsByIP which controls whether searching
+  for an IP address redirects to the contributions list for that IP
 
 === Bug fixes in 1.19 ===
 * $wgUploadNavigationUrl should be used for file redlinks if
index e75399a..c441fd1 100644 (file)
@@ -4330,6 +4330,13 @@ $wgSitemapNamespaces = false;
  */
 $wgSitemapNamespacesPriorities = false;
 
+/**
+ * Search IP
+ * Treat IP searches as a contributor search for those
+ * with permissions to do so.
+ */
+$wgEnableSearchContributorsByIP = true;
+
 /** @} */ # end of search settings
 
 /************************************************************************//**
index 04d289d..0cb91fa 100644 (file)
@@ -148,7 +148,7 @@ class SearchEngine {
         * Really find the title match.
         */
        private static function getNearMatchInternal( $searchterm ) {
-               global $wgContLang;
+               global $wgContLang, $wgEnableSearchContributorsByIP;
 
                $allSearchTerms = array( $searchterm );
 
@@ -215,10 +215,13 @@ class SearchEngine {
 
                $title = Title::newFromText( $searchterm );
 
+
                # Entering an IP address goes to the contributions page
-               if ( ( $title->getNamespace() == NS_USER && User::isIP( $title->getText() ) )
-                       || User::isIP( trim( $searchterm ) ) ) {
-                       return SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() );
+               if ( $wgEnableSearchContributorsByIP ) {
+                       if ( ( $title->getNamespace() == NS_USER && User::isIP( $title->getText() ) )
+                               || User::isIP( trim( $searchterm ) ) ) {
+                               return SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() );
+                       }
                }