Index: trunk/phase3/includes/api/ApiOpenSearch.php |
— | — | @@ -51,6 +51,20 @@ |
52 | 52 | $this->getMain()->setCacheMaxAge(1200); |
53 | 53 | |
54 | 54 | $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 | + } |
55 | 69 | |
56 | 70 | // Set top level elements |
57 | 71 | $result = $this->getResult(); |
— | — | @@ -73,6 +87,7 @@ |
74 | 88 | ApiBase :: PARAM_TYPE => 'namespace', |
75 | 89 | ApiBase :: PARAM_ISMULTI => true |
76 | 90 | ), |
| 91 | + 'redirects' => false, |
77 | 92 | ); |
78 | 93 | } |
79 | 94 | |
— | — | @@ -81,6 +96,7 @@ |
82 | 97 | 'search' => 'Search string', |
83 | 98 | 'limit' => 'Maximum amount of results to return', |
84 | 99 | 'namespace' => 'Namespaces to search', |
| 100 | + 'redirects' => 'Resolve redirects', |
85 | 101 | ); |
86 | 102 | } |
87 | 103 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -107,6 +107,8 @@ |
108 | 108 | * (bug 17069) Added ucshow=patrolled|!patrolled to list=usercontribs |
109 | 109 | * action=delete respects $wgDeleteRevisionsLimit and the bigdelete user right |
110 | 110 | * (bug 15949) Add undo functionality to action=edit |
| 111 | +* (bug 17142) Added redirects parameter to action=opensearch to control redirect |
| 112 | + resolution |
111 | 113 | |
112 | 114 | === Languages updated in 1.15 === |
113 | 115 | |