r86736 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86735‎ | r86736 | r86737 >
Date:20:25, 22 April 2011
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
Implemented param tracking for hook users, feels a bit hackish
Modified paths:
  • /trunk/extensions/Translate/TranslateEditAddons.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialSearch.php
@@ -34,6 +34,9 @@
3535 /// Search engine
3636 protected $searchEngine;
3737
 38+ /// For links
 39+ protected $extraParams = array();
 40+
3841 const NAMESPACES_CURRENT = 'sense';
3942
4043 public function __construct() {
@@ -436,7 +439,7 @@
437440 $opt['ns' . $n] = 1;
438441 }
439442 }
440 - return $opt;
 443+ return $opt + $this->extraParams;
441444 }
442445
443446 /**
@@ -1082,4 +1085,15 @@
10831086 }
10841087 return $this->searchEngine;
10851088 }
 1089+
 1090+ /**
 1091+ * Users of hook SpecialSearchSetupEngine can use this to
 1092+ * add more params to links to not lose selection when
 1093+ * user navigates search results.
 1094+ * @since 1.18
 1095+ */
 1096+ public function setExtraParam( $key, $value ) {
 1097+ $this->extraParams[$key] = $value;
 1098+ }
 1099+
10861100 }
Index: trunk/extensions/Translate/TranslateEditAddons.php
@@ -554,6 +554,7 @@
555555 $selected = $context->getRequest()->getVal( 'languagefilter' );
556556 if ( $selected !== '-' && $selected ) {
557557 $engine->setFeatureData( 'title-suffix-filter', "/$selected" );
 558+ $search->setExtraParam( 'languagefilter', $selected );
558559 }
559560 return true;
560561 }

Comments

#Comment by Brion VIBBER (talk | contribs)   23:54, 14 June 2011

It'll do. :)

Status & tagging log