* @param int $revid Number to pass in {{REVISIONID}}
* @return ParserOutput A ParserOutput
*/
- public function parse( $text, Title $title, ParserOptions $options,
+ public function parse(
+ $text, Title $title, ParserOptions $options,
$linestart = true, $clearState = true, $revid = null
) {
/**
}
}
+ # Done parsing! Compute runtime adaptive expiry if set
+ $this->mOutput->finalizeAdaptiveCacheExpiry();
+
+ # Warn if too many heavyweight parser functions were used
if ( $this->mExpensiveFunctionCount > $this->mOptions->getExpensiveParserFunctionLimit() ) {
$this->limitationWarn( 'expensive-parserfunction',
$this->mExpensiveFunctionCount,
$context->setUser( User::newFromName( '127.0.0.1', false ) );
}
$context->setLanguage( $this->mOptions->getUserLangObj() );
- $ret = SpecialPageFactory::capturePath( $title, $context, $this->getLinkRenderer() );
+ $ret = SpecialPageFactory::capturePath(
+ $title, $context, $this->getLinkRenderer() );
if ( $ret ) {
$text = $context->getOutput()->getHTML();
$this->mOutput->addOutputPageMetadata( $context->getOutput() );
$found = true;
$isHTML = true;
if ( $specialPage && $specialPage->maxIncludeCacheTime() !== false ) {
- $this->mOutput->updateCacheExpiry( $specialPage->maxIncludeCacheTime() );
+ $this->mOutput->updateRuntimeAdaptiveExpiry(
+ $specialPage->maxIncludeCacheTime()
+ );
}
}
} elseif ( MWNamespace::isNonincludable( $title->getNamespace() ) ) {
* @since 1.24
* @param Title $title
* @param Parser|bool $parser
- * @return Revision
+ * @return Revision|bool False if missing
*/
- public static function statelessFetchRevision( $title, $parser = false ) {
- return Revision::newFromTitle( $title );
+ public static function statelessFetchRevision( Title $title, $parser = false ) {
+ $pageId = $title->getArticleID();
+ $revId = $title->getLatestRevID();
+
+ $rev = Revision::newKnownCurrent( wfGetDB( DB_REPLICA ), $pageId, $revId );
+ if ( $rev ) {
+ $rev->setTitle( $title );
+ }
+
+ return $rev;
}
/**
*/
public function fetchScaryTemplateMaybeFromCache( $url ) {
global $wgTranscludeCacheExpiry;
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$tsCond = $dbr->timestamp( time() - $wgTranscludeCacheExpiry );
$obj = $dbr->selectRow( 'transcache', [ 'tc_time', 'tc_contents' ],
[ 'tc_url' => $url, "tc_time >= " . $dbr->addQuotes( $tsCond ) ] );