}
// Should we save old revision parses to the parser cache?
- $p_result = $this->content->getParserOutput( $titleObj, $popts );
+ $p_result = $this->content->getParserOutput( $titleObj, $rev->getId(), $popts );
}
} else { // Not $oldid, but $pageid or $page
if ( $params['redirects'] ) {
$oldid = $pageObj->getLatest();
}
-
$popts = $pageObj->makeParserOptions( $this->getContext() );
$popts->enableLimitReport( !$params['disablepp'] );
if ( !$titleObj ) {
$this->dieUsageMsg( array( 'invalidtitle', $title ) );
}
+ if ( !$titleObj->canExist() ) {
+ $this->dieUsage( "Namespace doesn't allow actual pages", 'pagecannotexist' );
+ }
$wgTitle = $titleObj;
$pageObj = WikiPage::factory( $titleObj );
// Not cached (save or load)
if ( $params['pst'] ) {
- $p_result = $this->pstContent->getParserOutput( $titleObj, $popts );
+ $p_result = $this->pstContent->getParserOutput( $titleObj, null, $popts );
} else {
- $p_result = $this->content->getParserOutput( $titleObj, $popts );
+ $p_result = $this->content->getParserOutput( $titleObj, null, $popts );
}
}
private function getParsedContent( WikiPage $page, $popts, $pageId = null, $getWikitext = false ) {
$this->content = $page->getContent( Revision::RAW ); //XXX: really raw?
- if ( $this->section !== false ) {
+ if ( $this->section !== false && $this->content !== null ) {
$this->content = $this->getSectionContent(
$this->content,
!is_null( $pageId ) ? 'page id ' . $pageId : $page->getTitle()->getText() );
// Not cached (save or load)
- return $this->content->getParserOutput( $page->getTitle(), $popts );
+ return $this->content->getParserOutput( $page->getTitle(), null, $popts );
} else {
// Try the parser cache first
// getParserOutput will save to Parser cache if able
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' => 'pagecannotexist', 'info' => "Namespace doesn't allow actual pages" ),
) );
}