Merge "Add CollationFa"
[lhc/web/wiklou.git] / includes / api / ApiExpandTemplates.php
index 10fb182..6f7cf65 100644 (file)
@@ -42,11 +42,9 @@ class ApiExpandTemplates extends ApiBase {
                $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'] );
@@ -57,13 +55,13 @@ class ApiExpandTemplates extends ApiBase {
                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'] ) ] );
                        }
                }
 
@@ -161,9 +159,7 @@ class ApiExpandTemplates extends ApiBase {
                                }
                                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' );
                                }
                        }
                }