From 4e7cbbb184377780fc530148f762fd06c987d498 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Tue, 15 Nov 2005 12:09:31 +0000 Subject: [PATCH] Save the results of the link cache update parse into the parser cache. This improves the speed of the inevitable subsequent page view. --- includes/Article.php | 10 +++------- includes/OutputPage.php | 4 ++-- includes/Parser.php | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index 3dfd273b63..5e13bf7ec6 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1423,14 +1423,10 @@ class Article { } } - # Parse the text and replace links with placeholders + # Parse the text and save it to the parser cache $wgOut = new OutputPage(); - - # Pass the current title along in case we're creating a wiki page - # which is different than the currently displayed one (e.g. image - # pages created on file uploads); otherwise, link updates will - # go wrong. - $wgOut->addWikiTextWithTitle( $text, $this->mTitle ); + $wgOut->setParserOptions( ParserOptions::newFromUser( $wgUser ) ); + $wgOut->addPrimaryWikiText( $text, $this ); if ( !$wgUseDumbLinkUpdate ) { # Move the current links back to the second register diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 638ec9b966..180c6a6ef3 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -266,9 +266,9 @@ class OutputPage { * Saves the text into the parser cache if possible */ function addPrimaryWikiText( $text, $cacheArticle ) { - global $wgParser, $wgParserCache, $wgUser, $wgTitle, $wgUseTidy; + global $wgParser, $wgParserCache, $wgUser, $wgUseTidy; - $parserOutput = $wgParser->parse( $text, $wgTitle, $this->mParserOptions, true ); + $parserOutput = $wgParser->parse( $text, $cacheArticle->mTitle, $this->mParserOptions, true ); $text = $parserOutput->getText(); diff --git a/includes/Parser.php b/includes/Parser.php index 95183bd20c..14f42e602d 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3674,7 +3674,7 @@ class ParserOutput function expired( $touched ) { global $wgCacheEpoch; return $this->getCacheTime() == -1 || // parser says it's uncacheable - $this->getCacheTime() <= $touched || + $this->getCacheTime() < $touched || $this->getCacheTime() <= $wgCacheEpoch || !isset( $this->mVersion ) || version_compare( $this->mVersion, MW_PARSER_VERSION, "lt" ); -- 2.20.1