Merge "SkinFactory: Improve documentation and comments"
[lhc/web/wiklou.git] / includes / api / ApiParse.php
index b906b59..d09470b 100644 (file)
@@ -213,7 +213,7 @@ class ApiParse extends ApiBase {
                        }
 
                        if ( $this->section !== false ) {
-                               $this->content = $this->getSectionContent( $this->content, $titleObj->getText() );
+                               $this->content = $this->getSectionContent( $this->content, $titleObj->getPrefixedText() );
                        }
 
                        if ( $params['pst'] || $params['onlypst'] ) {
@@ -450,7 +450,7 @@ class ApiParse extends ApiBase {
                if ( $this->section !== false && $this->content !== null ) {
                        $this->content = $this->getSectionContent(
                                $this->content,
-                               !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getText()
+                               !is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getPrefixedText()
                        );
 
                        // Not cached (save or load)
@@ -470,6 +470,10 @@ class ApiParse extends ApiBase {
                return $pout;
        }
 
+       /**
+        * @param Content $content
+        * @param string $what Identifies the content in error messages, e.g. page title.
+        */
        private function getSectionContent( Content $content, $what ) {
                // Not cached (save or load)
                $section = $content->getSection( $this->section );
@@ -800,29 +804,6 @@ class ApiParse extends ApiBase {
                );
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array(
-                               'code' => 'params',
-                               'info' => 'The page parameter cannot be used together with the text and title parameters'
-                       ),
-                       array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
-                       array(
-                               'code' => 'permissiondenied',
-                               'info' => 'You don\'t have permission to view deleted revisions'
-                       ),
-                       array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
-                       array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
-                       array( 'nosuchpageid' ),
-                       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.'
-                       ),
-               ) );
-       }
-
        public function getExamples() {
                return array(
                        'api.php?action=parse&page=Project:Sandbox' => 'Parse a page',