/** @var RevisionStore */
private $revisionStore;
+ /** @var TitleParser */
+ private $titleParser;
+
/**
* This module uses a custom feed wrapper printer.
*
public function execute() {
$this->revisionStore = MediaWikiServices::getInstance()->getRevisionStore();
+ $this->titleParser = MediaWikiServices::getInstance()->getTitleParser();
$params = $this->extractRequestParams();
' [' . $config->get( 'LanguageCode' ) . ']';
$feedUrl = SpecialPage::getTitleFor( 'Contributions', $params['user'] )->getFullURL();
- $target = $params['user'] == 'newbies'
- ? 'newbies'
- : Title::makeTitleSafe( NS_USER, $params['user'] )->getText();
+ try {
+ $target = $this->titleParser
+ ->parseTitle( $params['user'], NS_USER )
+ ->getText();
+ } catch ( MalformedTitleException $e ) {
+ $this->dieWithError(
+ [ 'apierror-baduser', 'user', wfEscapeWikiText( $params['user'] ) ],
+ 'baduser_' . $this->encodeParamName( 'user' )
+ );
+ }
$feed = new $feedClasses[$params['feedformat']] (
$feedTitle,