* returns true iff cache-ok headers was sent.
*/
function checkLastModified ( $timestamp ) {
- global $wgCachePages, $wgUser;
+ global $wgCachePages, $wgCacheEpoch, $wgUser;
if ( !$timestamp || $timestamp == '19700101000000' ) {
wfDebug( "CACHE DISABLED, NO TIMESTAMP\n" );
return;
}
$timestamp=wfTimestamp(TS_MW,$timestamp);
- $lastmod = wfTimestamp( TS_RFC2822, max( $timestamp, $wgUser->mTouched ) );
+ $lastmod = wfTimestamp( TS_RFC2822, max( $timestamp, $wgUser->mTouched, $wgCacheEpoch ) );
if( !empty( $_SERVER['HTTP_IF_MODIFIED_SINCE'] ) ) {
# IE sends sizes after the date like this:
$ismodsince = wfTimestamp( TS_MW, $modsinceTime ? $modsinceTime : 1 );
wfDebug( "-- client send If-Modified-Since: " . $modsince . "\n", false );
wfDebug( "-- we might send Last-Modified : $lastmod\n", false );
- if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) ) {
+ if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
# Make sure you're in a place you can leave when you call us!
header( "HTTP/1.0 304 Not Modified" );
$this->mLastModified = $lastmod;
$this->sendCacheControl();
- wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
+ wfDebug( "CACHED client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
$this->disable();
@ob_end_clean(); // Don't output compressed blob
return true;
} else {
- wfDebug( "READY client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp\n", false );
+ wfDebug( "READY client: $ismodsince ; user: $wgUser->mTouched ; page: $timestamp ; site $wgCacheEpoch\n", false );
$this->mLastModified = $lastmod;
}
} else {
function addPrimaryWikiText( $text, $article, $cache = true ) {
global $wgParser, $wgUser;
+ $this->mParserOptions->setTidy(true);
$parserOutput = $wgParser->parse( $text, $article->mTitle,
$this->mParserOptions, true, true, $this->mRevisionId );
-
- if ( $article && $parserOutput->getCacheTime() != -1 ) {
+ $this->mParserOptions->setTidy(false);
+ 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() );
+ }
+
+ /**
+ * For anything that isn't primary text or interface message
+ */
+ function addSecondaryWikiText( $text, $linestart = true ) {
+ global $wgTitle;
+ $this->mParserOptions->setTidy(true);
+ $this->addWikiTextTitle($text, $wgTitle, $linestart);
+ $this->mParserOptions->setTidy(false);
}
+
/**
* Add the output of a QuickTemplate to the output buffer
* @param QuickTemplate $template
$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 );
if ( '' == $returnto ) {
$returnto = wfMsgForContent( 'mainpage' );
}
- $link = $sk->makeKnownLink( $returnto, '' );
+ $link = $sk->makeLinkObj( Title::newFromText( $returnto ), '' );
$r = wfMsg( 'returnto', $link );
if ( $auto ) {