From 16a169c6c83df99a8c9bf5cf55af5ef3fdc9562d Mon Sep 17 00:00:00 2001 From: S Page Date: Tue, 22 Jul 2014 18:26:53 -0700 Subject: [PATCH] Provide namespace to ApiParse->getSectionContent Improves the "Sections are not supported by " error message when it fails. Also add phpdoc comment Bug: 68416 Change-Id: Iaa5d3a1f33b8a9c48263c2ce27cd3b4fe98fbf01 --- includes/api/ApiParse.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/api/ApiParse.php b/includes/api/ApiParse.php index b906b5960a..2e993e3648 100644 --- a/includes/api/ApiParse.php +++ b/includes/api/ApiParse.php @@ -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 ); -- 2.20.1