r46341 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46340‎ | r46341 | r46342 >
Date:14:43, 27 January 2009
Author:catrope
Status:reverted (Comments)
Tags:
Comment:
API: (bug 17142) Add redirects parameter to action=opensearch to control redirect resolution. Changes to OpenSearchXML extension in next commit
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/api/ApiOpenSearch.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiOpenSearch.php
@@ -51,6 +51,20 @@
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+ }
5569
5670 // Set top level elements
5771 $result = $this->getResult();
@@ -73,6 +87,7 @@
7488 ApiBase :: PARAM_TYPE => 'namespace',
7589 ApiBase :: PARAM_ISMULTI => true
7690 ),
 91+ 'redirects' => false,
7792 );
7893 }
7994
@@ -81,6 +96,7 @@
8297 'search' => 'Search string',
8398 'limit' => 'Maximum amount of results to return',
8499 'namespace' => 'Namespaces to search',
 100+ 'redirects' => 'Resolve redirects',
85101 );
86102 }
87103
Index: trunk/phase3/RELEASE-NOTES
@@ -107,6 +107,8 @@
108108 * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs
109109 * action=delete respects $wgDeleteRevisionsLimit and the bigdelete user right
110110 * (bug 15949) Add undo functionality to action=edit
 111+* (bug 17142) Added redirects parameter to action=opensearch to control redirect
 112+ resolution
111113
112114 === Languages updated in 1.15 ===
113115

Follow-up revisions

RevisionCommit summaryAuthorDate
r46342OpenSearchXML extension: Respect redirects parameter added in r46341 (previou...catrope14:44, 27 January 2009
r46379Pulling back r46341 and r46342 for now "API: (bug 17142) Add redirects parame...brion20:39, 27 January 2009

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

Comments

#Comment by Brion VIBBER (talk | contribs)   20:39, 27 January 2009

Reverted in r46379

Status & tagging log