From 6cd1a1b1d950f9f8411a0dd251233614a00f2a44 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 13 Mar 2009 20:15:16 +0000 Subject: [PATCH] * Avoid double output on filecache failover * XHTML fixes to error html * Added isDisabled() to OutputPage * Make sure filecache marks output done --- includes/Exception.php | 2 +- includes/HTMLFileCache.php | 2 +- includes/OutputPage.php | 3 ++- includes/db/Database.php | 6 +++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/Exception.php b/includes/Exception.php index 199011ddda..10765bd7a7 100644 --- a/includes/Exception.php +++ b/includes/Exception.php @@ -207,7 +207,7 @@ class MWException extends Exception { $title -

$title

+

$title

"; } diff --git a/includes/HTMLFileCache.php b/includes/HTMLFileCache.php index 5745de4334..68cafa242c 100644 --- a/includes/HTMLFileCache.php +++ b/includes/HTMLFileCache.php @@ -128,7 +128,6 @@ class HTMLFileCache { public function loadFromFileCache() { global $wgOut, $wgMimeType, $wgOutputEncoding, $wgContLanguageCode; wfDebug(" loadFromFileCache()\n"); - $filename = $this->fileCacheName(); // Raw pages should handle cache control on their own, // even when using file cache. This reduces hits from clients. @@ -148,6 +147,7 @@ class HTMLFileCache { } } readfile( $filename ); + $wgOut->disable(); // tell $wgOut that output is taken care of } protected function checkCacheDirs() { diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 7f8583a956..f6a5601d3f 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -166,7 +166,7 @@ class OutputPage { * * @return bool True iff cache-ok headers was sent. */ - function checkLastModified ( $timestamp ) { + function checkLastModified( $timestamp ) { global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest; if ( !$timestamp || $timestamp == '19700101000000' ) { @@ -339,6 +339,7 @@ class OutputPage { public function setOnloadHandler( $js ) { $this->mOnloadHandler = $js; } public function getOnloadHandler() { return $this->mOnloadHandler; } public function disable() { $this->mDoNothing = true; } + public function isDisabled() { return $this->mDoNothing; } public function setArticleRelated( $v ) { $this->mIsArticleRelated = $v; diff --git a/includes/db/Database.php b/includes/db/Database.php index 97b77460fd..8d25b2b2af 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2618,7 +2618,7 @@ class DBConnectionError extends DBError { - + @@ -2633,8 +2633,8 @@ EOT; } function fileCachedPage() { - global $wgTitle, $title, $wgLang; - + global $wgTitle, $title, $wgLang, $wgOut; + if( $wgOut->isDisabled() ) return; // Done already? $cachederror = "The following is a cached copy of the requested page, and may not be up to date. "; $mainpage = 'Main Page'; if ( $wgLang instanceof Language ) { -- 2.20.1