From a123a76c8a8b289ff7c0211c466c128b4ede06ef Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Mon, 14 Nov 2011 20:00:35 +0000 Subject: [PATCH] (bug 19833) Make the searching-for-an-IP-means-you-want-Special:Contributions behavior configurable. Patch by Olivier Finlay Beaton --- CREDITS | 1 + RELEASE-NOTES-1.19 | 2 ++ includes/DefaultSettings.php | 7 +++++++ includes/search/SearchEngine.php | 11 +++++++---- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CREDITS b/CREDITS index d6677dc64c..4e559f283c 100644 --- 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 diff --git a/RELEASE-NOTES-1.19 b/RELEASE-NOTES-1.19 index acdaff6a74..1fd3603bfc 100644 --- a/RELEASE-NOTES-1.19 +++ b/RELEASE-NOTES-1.19 @@ -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 diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index e75399a229..c441fd1635 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -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 /************************************************************************//** diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php index 04d289d6d3..0cb91fa5b2 100644 --- a/includes/search/SearchEngine.php +++ b/includes/search/SearchEngine.php @@ -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() ); + } } -- 2.20.1