X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiExpandTemplates.php;h=e15d7da1e588d6d8bb5feaf563c7ec6e9b1f6863;hb=036b9c41674a8eb1bdcd71a15fffb5a091223d9e;hp=48e7698147f316c68e2a95a96c442116a5f41513;hpb=f7424ee74e4dd7946d7fa219f8c3962d9970a146;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index 48e7698147..e15d7da1e5 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -34,7 +34,7 @@ class ApiExpandTemplates extends ApiBase { public function execute() { - // Cache may vary on $wgUser because ParserOptions gets data from it + // Cache may vary on the user because ParserOptions gets data from it $this->getMain()->setCacheMode( 'anon-public-user-private' ); // Get parameters @@ -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' ); } } } @@ -214,6 +210,6 @@ class ApiExpandTemplates extends ApiBase { } 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'; } }