r46379 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46378‎ | r46379 | r46380 >
Date:20:39, 27 January 2009
Author:brion
Status:ok
Tags:
Comment:
Pulling back r46341 and r46342 for now "API: (bug 17142) Add redirects parameter to action=opensearch to control redirect resolution. Changes to OpenSearchXML extension in next commit"
Mysteriously there's no way to get a boolean parameter to default to true, which leads to an incompatibility in the sensible behavior of the more detailed responses in the XML output -- eg you get a whole buttload of "#REDIRECT Blabla" in your results, which is absolutely hideous. This is very much not desireable. :)
If we could change the default, and allow it to be set on or off for specific requests if some person for some reason is doing highly customized suggestion searches and wants it configured differently (no idea why), that might be doable. But as written this doesn't make any sense.
Modified paths:
  • /trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php (modified) (history)
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiOpenSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiOpenSearch.php
@@ -51,20 +51,6 @@
5252 $this->getMain()->setCacheMaxAge(1200);
5353
5454 $srchres = PrefixSearch::titleSearch( $search, $limit, $namespaces );
55 -
56 - if( $params['redirects'] ) {
57 - foreach( $srchres as &$t ) {
58 - $title = Title::newFromText( $t );
59 - if( is_null( $title ) ) {
60 - continue;
61 - }
62 - $article = new Article( $title );
63 - $redirTitle = $article->getRedirectTarget();
64 - if( !is_null( $redirTitle ) ) {
65 - $t = $redirTitle->getPrefixedText();
66 - }
67 - }
68 - }
6955
7056 // Set top level elements
7157 $result = $this->getResult();
@@ -87,7 +73,6 @@
8874 ApiBase :: PARAM_TYPE => 'namespace',
8975 ApiBase :: PARAM_ISMULTI => true
9076 ),
91 - 'redirects' => false,
9277 );
9378 }
9479
@@ -96,7 +81,6 @@
9782 'search' => 'Search string',
9883 'limit' => 'Maximum amount of results to return',
9984 'namespace' => 'Namespaces to search',
100 - 'redirects' => 'Resolve redirects',
10185 );
10286 }
10387
Index: trunk/phase3/RELEASE-NOTES
@@ -114,8 +114,6 @@
115115 * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs
116116 * action=delete respects $wgDeleteRevisionsLimit and the bigdelete user right
117117 * (bug 15949) Add undo functionality to action=edit
118 -* (bug 17142) Added redirects parameter to action=opensearch to control redirect
119 - resolution
120118
121119 === Languages updated in 1.15 ===
122120
Index: trunk/extensions/OpenSearchXml/ApiOpenSearchXml.php
@@ -66,7 +66,6 @@
6767 $search = $params['search'];
6868 $limit = $params['limit'];
6969 $namespaces = $params['namespace'];
70 - $this->redirects = $params['redirects'];
7170
7271 // Open search results may be stored for a very long time
7372 $this->getMain()->setCacheMaxAge(1200);
@@ -90,11 +89,9 @@
9190 }
9291
9392 protected function formatItem( $name ) {
94 - $title = Title::newFromText( $name );
 93+ $title = TItle::newFromText( $name );
9594 if( $title ) {
96 - if( $this->redirects ) {
97 - $title = $this->_checkRedirect( $title );
98 - }
 95+ $title = $this->_checkRedirect( $title );
9996 if( $this->_seen( $title ) ) {
10097 return false;
10198 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r46131OpenSearchXml extension: (bug 17142) action=opensearch shouldn't resolve redi...catrope12:04, 24 January 2009
r46295Reverting r46131 "OpenSearchXml extension: (bug 17142) action=opensearch shou...brion22:57, 26 January 2009
r46341API: (bug 17142) Add redirects parameter to action=opensearch to control redi...catrope14:43, 27 January 2009
r46342OpenSearchXML extension: Respect redirects parameter added in r46341 (previou...catrope14:44, 27 January 2009

Status & tagging log