X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiExpandTemplates.php;h=562bcdf9da6ed227d938aa3cf58e6f4dca162927;hb=948bdf5746444d72e82c4199b5dd676ecb1658a8;hp=fe49b259373e12b7f63518469a94b81a1678213e;hpb=7babd362babcbf7f20adb8e12edb4f4bc1d4249f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index fe49b25937..562bcdf9da 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -20,6 +20,8 @@ * @file */ +use MediaWiki\MediaWikiServices; + /** * API module that functions as a shortcut to the wikitext preprocessor. Expands * any templates in a provided string, and returns the result of this expansion @@ -48,7 +50,7 @@ class ApiExpandTemplates extends ApiBase { if ( $params['prop'] === null ) { $this->addDeprecation( - 'apiwarn-deprecation-expandtemplates-prop', 'action=expandtemplates&!prop' + [ 'apiwarn-deprecation-missingparam', 'prop' ], 'action=expandtemplates&!prop' ); $prop = []; } else { @@ -63,12 +65,12 @@ class ApiExpandTemplates extends ApiBase { // Get title and revision ID for parser $revid = $params['revid']; if ( $revid !== null ) { - $rev = Revision::newFromId( $revid ); + $rev = MediaWikiServices::getInstance()->getRevisionStore()->getRevisionById( $revid ); if ( !$rev ) { $this->dieWithError( [ 'apierror-nosuchrevid', $revid ] ); } $pTitleObj = $titleObj; - $titleObj = $rev->getTitle(); + $titleObj = Title::newFromLinkTarget( $rev->getPageAsLinkTarget() ); if ( $titleProvided ) { if ( !$titleObj->equals( $pTitleObj ) ) { $this->addWarning( [ 'apierror-revwrongpage', $rev->getId(),