r103019 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103018‎ | r103019 | r103020 >
Date:20:00, 14 November 2011
Author:catrope
Status:resolved (Comments)
Tags:
Comment:
(bug 19833) Make the searching-for-an-IP-means-you-want-Special:Contributions behavior configurable. Patch by Olivier Finlay Beaton
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/search/SearchEngine.php (modified) (history)

Diff [purge]

Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -81,6 +81,8 @@
8282 * (bug 30062) Add $wgDBprefix option to cli installer
8383 * getUserPermissionsErrors and getUserPermissionsErrorsExpensive hooks are now
8484 also called when checking for 'read' permission
 85+* Introduce $wgEnableSearchContributorsByIP which controls whether searching
 86+ for an IP address redirects to the contributions list for that IP
8587
8688 === Bug fixes in 1.19 ===
8789 * $wgUploadNavigationUrl should be used for file redlinks if
Index: trunk/phase3/CREDITS
@@ -145,6 +145,7 @@
146146 * Nx.devnull
147147 * Nikolaos S. Karastathis
148148 * Olaf Lenz
 149+* Olivier Finlay Beaton
149150 * Paul Copperman
150151 * Paul Oranje
151152 * PieRRoMaN
Index: trunk/phase3/includes/search/SearchEngine.php
@@ -148,7 +148,7 @@
149149 * Really find the title match.
150150 */
151151 private static function getNearMatchInternal( $searchterm ) {
152 - global $wgContLang;
 152+ global $wgContLang, $wgEnableSearchContributorsByIP;
153153
154154 $allSearchTerms = array( $searchterm );
155155
@@ -215,10 +215,13 @@
216216
217217 $title = Title::newFromText( $searchterm );
218218
 219+
219220 # Entering an IP address goes to the contributions page
220 - if ( ( $title->getNamespace() == NS_USER && User::isIP( $title->getText() ) )
221 - || User::isIP( trim( $searchterm ) ) ) {
222 - return SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() );
 221+ if ( $wgEnableSearchContributorsByIP ) {
 222+ if ( ( $title->getNamespace() == NS_USER && User::isIP( $title->getText() ) )
 223+ || User::isIP( trim( $searchterm ) ) ) {
 224+ return SpecialPage::getTitleFor( 'Contributions', $title->getDBkey() );
 225+ }
223226 }
224227
225228
Index: trunk/phase3/includes/DefaultSettings.php
@@ -4330,6 +4330,13 @@
43314331 */
43324332 $wgSitemapNamespacesPriorities = false;
43334333
 4334+/**
 4335+ * Search IP
 4336+ * Treat IP searches as a contributor search for those
 4337+ * with permissions to do so.
 4338+ */
 4339+$wgEnableSearchContributorsByIP = true;
 4340+
43344341 /** @} */ # end of search settings
43354342
43364343 /************************************************************************//**

Follow-up revisions

RevisionCommit summaryAuthorDate
r103308Clarify comment in r103019catrope10:37, 16 November 2011

Comments

#Comment by Nikerabbit (talk | contribs)   10:26, 15 November 2011

What permission? What happens if this is false? What is the use case? I think documentation should be improved.

#Comment by P858snake (talk | contribs)   10:28, 15 November 2011

I'm guessing it changes what the search box does if you enter a IP address.

#Comment by Nikerabbit (talk | contribs)   10:45, 15 November 2011

I figured out that much, but not more, hence my questions.

#Comment by Catrope (talk | contribs)   10:34, 16 November 2011

Right, the permission thing makes no sense. Fixing.

#Comment by P858snake (talk | contribs)   23:40, 18 November 2011

Should we change the default search behaviour like this? Since most people (even just end users) wouldn't expect this unless they have read the release notes. (And IP addresses isn't such a strange thing, I know of a few that do it)

#Comment by Nikerabbit (talk | contribs)   04:59, 19 November 2011

Are you proposing a change or saying that the default should not be changed (it was not)?

Status & tagging log