Restoring ThomasV's patch for a hook & use of the existing $cache parameter on addPrimaryWikiText.

Further testing indicates the problem was probably an incomplete sync or bad caching of
OutputPage.php on some servers, so the broken version of the function was called
on old page views, incorrectly storing old text items into the parser cache.
This commit is contained in:
Brion Vibber 2006-01-14 23:56:01 +00:00
parent 5533f8c9b6
commit 261a683265
3 changed files with 13 additions and 4 deletions

View file

@ -483,6 +483,8 @@ fully support the editing toolbar, but was found to be too confusing.
* (bug 1103) Fix up redirect handling for images, categories
Redirects are now followed from the top-level, outside of the Article
content loading and viewing, for clarity and consistency.
* (bug 4104) 'OutputPageBeforeHTML' hook to postprocess article HTML on
page view (comes after parser cache, if used). Patch by ThomasV.
* Linker::formatComment corrupted the passed title object on PHP 5
if the comment included a section link. Use clone() to make a safe copy.
* Add wfClone() wrapper since we're still using PHP 4 on some servers.

View file

@ -875,7 +875,8 @@ class Article {
if( !$this->isCurrent() ) {
$oldEditSectionSetting = $wgOut->mParserOptions->setEditSection( false );
}
$wgOut->addWikiText( $text );
# Display content and don't save to parser cache
$wgOut->addPrimaryWikiText( $text, $this, false );
if( !$this->isCurrent() ) {
$wgOut->mParserOptions->setEditSection( $oldEditSectionSetting );

View file

@ -309,12 +309,16 @@ class OutputPage {
$parserOutput = $wgParser->parse( $text, $article->mTitle,
$this->mParserOptions, true, true, $this->mRevisionId );
if ( $article && $parserOutput->getCacheTime() != -1 ) {
if ( $cache && $article && $parserOutput->getCacheTime() != -1 ) {
$parserCache =& ParserCache::singleton();
$parserCache->save( $parserOutput, $article, $wgUser );
}
$this->addParserOutput( $parserOutput );
$this->addParserOutputNoText( $parserOutput );
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML',array( &$this, &$text ) );
$parserOutput->setText( $text );
$this->addHTML( $parserOutput->getText() );
}
/**
@ -351,7 +355,9 @@ class OutputPage {
$this->mLanguageLinks += $parserOutput->getLanguageLinks();
$this->addCategoryLinks( $parserOutput->getCategories() );
$this->addKeywords( $parserOutput );
$this->addHTML( $parserOutput->getText() );
$text = $parserOutput->getText();
wfRunHooks( 'OutputPageBeforeHTML', array( &$this, &$text ) );
$this->addHTML( $text );
$t = $parserOutput->getTitleText();
if( !empty( $t ) ) {
$this->setPageTitle( $t );