From d9022f63880ce039446fba8364f68e656b7bf4cb Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 3 May 2012 13:01:35 +0200 Subject: Update to MediaWiki 1.19.0 --- includes/api/ApiExpandTemplates.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'includes/api/ApiExpandTemplates.php') diff --git a/includes/api/ApiExpandTemplates.php b/includes/api/ApiExpandTemplates.php index dfa520a2..d570534d 100644 --- a/includes/api/ApiExpandTemplates.php +++ b/includes/api/ApiExpandTemplates.php @@ -24,11 +24,6 @@ * @file */ -if ( !defined( 'MEDIAWIKI' ) ) { - // Eclipse helper - will be ignored in production - require_once( "ApiBase.php" ); -} - /** * 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 @@ -52,14 +47,14 @@ class ApiExpandTemplates extends ApiBase { // Create title for parser $title_obj = Title::newFromText( $params['title'] ); if ( !$title_obj ) { - $title_obj = Title::newFromText( 'API' ); // default + $this->dieUsageMsg( array( 'invalidtitle', $params['title'] ) ); } $result = $this->getResult(); // Parse text global $wgParser; - $options = new ParserOptions(); + $options = ParserOptions::newFromContext( $this->getContext() ); if ( $params['includecomments'] ) { $options->setRemoveComments( false ); @@ -112,7 +107,13 @@ class ApiExpandTemplates extends ApiBase { return 'Expands all templates in wikitext'; } - protected function getExamples() { + public function getPossibleErrors() { + return array_merge( parent::getPossibleErrors(), array( + array( 'invalidtitle', 'title' ), + ) ); + } + + public function getExamples() { return array( 'api.php?action=expandtemplates&text={{Project:Sandbox}}' ); -- cgit v1.2.3-54-g00ecf