From: S Page Date: Wed, 23 Jul 2014 01:26:53 +0000 (-0700) Subject: Provide namespace to ApiParse->getSectionContent X-Git-Tag: 1.31.0-rc.0~14805^2 X-Git-Url: http://git.cyclocoop.org/ecrire?a=commitdiff_plain;h=16a169c6c83df99a8c9bf5cf55af5ef3fdc9562d;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );