* Avoid double output on filecache failover
authorAaron Schulz <aaron@users.mediawiki.org>
Fri, 13 Mar 2009 20:15:16 +0000 (20:15 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Fri, 13 Mar 2009 20:15:16 +0000 (20:15 +0000)
* XHTML fixes to error html
* Added isDisabled() to OutputPage
* Make sure filecache marks output done

includes/Exception.php
includes/HTMLFileCache.php
includes/OutputPage.php
includes/db/Database.php

index 199011d..10765bd 100644 (file)
@@ -207,7 +207,7 @@ class MWException extends Exception {
                <title>$title</title>
                </head>
                <body>
-               <h1><img src='$wgLogo' style='float:left;margin-right:1em' alt=''>$title</h1>
+               <h1><img src='$wgLogo' style='float:left;margin-right:1em' alt=''/>$title</h1>
                ";
        }
 
index 5745de4..68cafa2 100644 (file)
@@ -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() {
index 7f8583a..f6a5601 100644 (file)
@@ -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;
index 97b7746..8d25b2b 100644 (file)
@@ -2618,7 +2618,7 @@ class DBConnectionError extends DBError {
     <input type="hidden" name="ie" value="$wgInputEncoding" />
     <input type="hidden" name="oe" value="$wgInputEncoding" />
 
-    <img src="http://www.google.com/logos/Logo_40wht.gif" style="float:left; margin-left: 1.5em; margin-right: 1.5em;" />
+    <img src="http://www.google.com/logos/Logo_40wht.gif" alt="" style="float:left; margin-left: 1.5em; margin-right: 1.5em;" />
 
     <input type="text" name="q" size="31" maxlength="255" value="$search" />
     <input type="submit" name="btnG" value="$googlesearch" />
@@ -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 ) {