Merge "Don't try and run a special page through action=parsex"
authorIAlex <ialex.wiki@gmail.com>
Tue, 23 Oct 2012 16:14:39 +0000 (16:14 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 23 Oct 2012 16:14:39 +0000 (16:14 +0000)
includes/api/ApiParse.php

index 870fba9..37cab04 100644 (file)
@@ -165,6 +165,9 @@ class ApiParse extends ApiBase {
                        if ( !$titleObj ) {
                                $this->dieUsageMsg( array( 'invalidtitle', $title ) );
                        }
+                       if ( $titleObj->isSpecialPage() ) {
+                               $this->dieUsage( 'Special pages cannot be parsed through action=parse', 'targetisspecial' );
+                       }
                        $wgTitle = $titleObj;
                        $pageObj = WikiPage::factory( $titleObj );
 
@@ -652,6 +655,7 @@ class ApiParse extends ApiBase {
                        array( 'invalidtitle', 'title' ),
                        array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
                        array( 'code' => 'notwikitext', 'info' => 'The requested operation is only supported on wikitext content.' ),
+                       array( 'code' => 'targetisspecial', 'info' => 'Special pages cannot be parsed through action=parse' ),
                ) );
        }