Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -57,7 +57,38 @@ |
58 | 58 | if ( !$titleObj || $titleObj->isExternal() ) { |
59 | 59 | $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); |
60 | 60 | } |
| 61 | + |
| 62 | + if( $params['redirect'] ) { |
| 63 | + if( $titleObj->isRedirect() ) { |
| 64 | + $oldTitle = $titleObj; |
| 65 | + |
| 66 | + $titles = Title::newFromRedirectArray( Revision::newFromTitle( $oldTitle )->getText( Revision::FOR_THIS_USER ) ); |
| 67 | + //array_shift( $titles ); |
| 68 | + |
| 69 | + $this->getResult()->addValue( null, 'foo', $titles ); |
| 70 | + |
| 71 | + |
| 72 | + $redirValues = array(); |
| 73 | + foreach ( $titles as $id => $newTitle ) { |
| 74 | + |
| 75 | + if( !isset( $titles[ $id - 1 ] ) ) { |
| 76 | + $titles[ $id - 1 ] = $oldTitle; |
| 77 | + } |
| 78 | + |
| 79 | + $redirValues[] = array( |
| 80 | + 'from' => $titles[ $id - 1 ]->getPrefixedText(), |
| 81 | + 'to' => $newTitle->getPrefixedText() |
| 82 | + ); |
| 83 | + |
| 84 | + $titleObj = $newTitle; |
| 85 | + } |
| 86 | + |
| 87 | + $this->getResult()->setIndexedTagName( $redirValues, 'r' ); |
| 88 | + $this->getResult()->addValue( null, 'redirects', $redirValues ); |
61 | 89 | |
| 90 | + } |
| 91 | + } |
| 92 | + |
62 | 93 | // Some functions depend on $wgTitle == $ep->mTitle |
63 | 94 | global $wgTitle; |
64 | 95 | $wgTitle = $titleObj; |
— | — | @@ -428,6 +459,10 @@ |
429 | 460 | 'undoafter' => array( |
430 | 461 | ApiBase::PARAM_TYPE => 'integer' |
431 | 462 | ), |
| 463 | + 'redirect' => array( |
| 464 | + ApiBase::PARAM_TYPE => 'boolean', |
| 465 | + ApiBase::PARAM_DFLT => false, |
| 466 | + ), |
432 | 467 | ); |
433 | 468 | } |
434 | 469 | |
— | — | @@ -462,6 +497,7 @@ |
463 | 498 | 'appendtext' => "Add this text to the end of the page. Overrides {$p}text", |
464 | 499 | 'undo' => "Undo this revision. Overrides {$p}text, {$p}prependtext and {$p}appendtext", |
465 | 500 | 'undoafter' => 'Undo all revisions from undo to this one. If not set, just undo one revision', |
| 501 | + 'redirect' => 'Automatically resolve redirects', |
466 | 502 | ); |
467 | 503 | } |
468 | 504 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -331,7 +331,8 @@ |
332 | 332 | * (bug 24677) axto= parameters added to allcategories, allimages, alllinks, allmessages, |
333 | 333 | allpages, and allusers |
334 | 334 | * (bug 24236) Add add, remove, add-self, remove-self tags to meta=siteinfo&siprop=usergroups |
335 | | -* (bug 24484) Add prop=pageprops module |
| 335 | +* (bug 24484) Add prop=pageprops module |
| 336 | +* (bug 24330) Add &redirect parameter to ?action=edit |
336 | 337 | |
337 | 338 | === Languages updated in 1.17 === |
338 | 339 | |