$this->requireMaxOneParameter( $params, 'prop', 'generatexml' );
if ( $params['prop'] === null ) {
- $this->logFeatureUsage( 'action=expandtemplates&!prop' );
- $this->setWarning( 'Because no values have been specified for the prop parameter, a ' .
- 'legacy format has been used for the output. This format is deprecated, and in ' .
- 'the future, a default value will be set for the prop parameter, causing the new' .
- 'format to always be used.' );
+ $this->addDeprecation(
+ 'apiwarn-deprecation-expandtemplates-prop', 'action=expandtemplates&!prop'
+ );
$prop = [];
} else {
$prop = array_flip( $params['prop'] );
if ( $revid !== null ) {
$rev = Revision::newFromId( $revid );
if ( !$rev ) {
- $this->dieUsage( "There is no revision ID $revid", 'missingrev' );
+ $this->dieWithError( [ 'apierror-nosuchrevid', $revid ] );
}
$title_obj = $rev->getTitle();
} else {
$title_obj = Title::newFromText( $params['title'] );
if ( !$title_obj || $title_obj->isExternal() ) {
- $this->dieUsageMsg( [ 'invalidtitle', $params['title'] ] );
+ $this->dieWithError( [ 'apierror-invalidtitle', wfEscapeWikiText( $params['title'] ) ] );
}
}
}
if ( isset( $prop['modules'] ) &&
!isset( $prop['jsconfigvars'] ) && !isset( $prop['encodedjsconfigvars'] ) ) {
- $this->setWarning( "Property 'modules' was set but not 'jsconfigvars' " .
- "or 'encodedjsconfigvars'. Configuration variables are necessary " .
- 'for proper module usage.' );
+ $this->addWarning( 'apiwarn-moduleswithoutvars' );
}
}
}
}
public function getHelpUrls() {
- return 'https://www.mediawiki.org/wiki/API:Parsing_wikitext#expandtemplates';
+ return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Parsing_wikitext#expandtemplates';
}
}