From: Brad Jorsch Date: Thu, 9 Jan 2014 16:53:08 +0000 (-0500) Subject: API: Allow special pages for action=parse&title= X-Git-Tag: 1.31.0-rc.0~17321^2 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=83a51c0e7129084c2db3d53e26d46f606c0e25a0;p=lhc%2Fweb%2Fwiklou.git API: Allow special pages for action=parse&title= Iec98e472 had broken this. Use the same strategy as in MediaWiki::initializeArticle to work around the problem. Bug: 49477 Change-Id: Ib272b1f9395f6adade505ac7c6a24f9a4bff2779 --- diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index a323aad954..464fde66c0 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -176,11 +176,14 @@ class ApiParse extends ApiBase { if ( !$titleObj || $titleObj->isExternal() ) { $this->dieUsageMsg( array( 'invalidtitle', $title ) ); } - if ( !$titleObj->canExist() ) { - $this->dieUsage( "Namespace doesn't allow actual pages", 'pagecannotexist' ); - } $wgTitle = $titleObj; - $pageObj = WikiPage::factory( $titleObj ); + if ( $titleObj->canExist() ) { + $pageObj = WikiPage::factory( $titleObj ); + } else { + // Do like MediaWiki::initializeArticle() + $article = Article::newFromTitle( $titleObj, $this->getContext() ); + $pageObj = $article->getPage(); + } $popts = $this->makeParserOptions( $pageObj, $params ); @@ -805,7 +808,6 @@ class ApiParse extends ApiBase { 'code' => 'notwikitext', 'info' => 'The requested operation is only supported on wikitext content.' ), - array( 'code' => 'pagecannotexist', 'info' => "Namespace doesn't allow actual pages" ), ) ); }