Provide namespace to ApiParse->getSectionContent
authorS Page <spage@wikimedia.org>
Wed, 23 Jul 2014 01:26:53 +0000 (18:26 -0700)
committerS Page <spage@wikimedia.org>
Wed, 23 Jul 2014 01:26:53 +0000 (18:26 -0700)
Improves the "Sections are not supported by <PAGE>" error message when
it fails.  Also add phpdoc comment

Bug: 68416
Change-Id: Iaa5d3a1f33b8a9c48263c2ce27cd3b4fe98fbf01

includes/api/ApiParse.php

index b906b59..2e993e3 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 );