Merge "Update for API error i18n"

This commit is contained in:
jenkins-bot 2016-12-06 09:31:13 +00:00 committed by Gerrit Code Review
commit 087a0e7733
2 changed files with 9 additions and 8 deletions

View file

@ -132,15 +132,12 @@ class TitleBlacklistHooks {
$blacklisted = $titleBlacklist->userCannot( $oldTitle, $user, 'edit' );
}
if ( $blacklisted instanceof TitleBlacklistEntry ) {
$errmsg = $blacklisted->getErrorMessage( 'move' );
ApiBase::$messageMap[$errmsg] = array(
'code' => $errmsg,
'info' => 'TitleBlacklist prevents this new title from being created or old title from being edited'
);
$status->fatal( $errmsg,
$status->fatal( ApiMessage::create( [
$blacklisted->getErrorMessage( 'move' ),
$blacklisted->getRaw(),
$oldTitle->getFullText(),
$newTitle->getFullText() );
$newTitle->getFullText()
] ) );
return false;
}

View file

@ -45,7 +45,11 @@ class ApiQueryTitleBlacklist extends ApiBase {
$title = Title::newFromText( $params['title'] );
if ( !$title ) {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
if ( is_callable( [ $this, 'dieWithError' ] ) ) {
$this->dieWithError( array( 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ) );
} else {
$this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) );
}
}
$blacklisted = TitleBlacklist::singleton()->userCannot( $title, $this->getUser(), $action, $override );