debug statements for HTMLFileCache / Output
authorAntoine Musso <hashar@users.mediawiki.org>
Thu, 9 Feb 2012 10:56:36 +0000 (10:56 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Thu, 9 Feb 2012 10:56:36 +0000 (10:56 +0000)
includes/OutputHandler.php
includes/cache/HTMLFileCache.php

index 4112f8a..747140a 100644 (file)
@@ -76,7 +76,12 @@ function wfRequestExtension() {
  * @return string
  */
 function wfGzipHandler( $s ) {
-       if( !function_exists( 'gzencode' ) || headers_sent() ) {
+       if( !function_exists( 'gzencode' ) ) {
+               wfDebug( __FUNCTION__ . "() skipping compression (gzencode unavaible)\n" );
+               return $s;
+       }
+       if( headers_sent() ) {
+               wfDebug( __FUNCTION__ . "() skipping compression (headers already sent)\n" );
                return $s;
        }
 
@@ -90,6 +95,7 @@ function wfGzipHandler( $s ) {
        }
 
        if( wfClientAcceptsGzip() ) {
+               wfDebug( __FUNCTION__ . "() is compressing output\n" );
                header( 'Content-Encoding: gzip' );
                $s = gzencode( $s, 6 );
        }
index 92130f6..12e9b2d 100644 (file)
@@ -105,6 +105,7 @@ class HTMLFileCache extends FileCacheBase {
 
                wfDebug( __METHOD__ . "()\n");
                $filename = $this->cachePath();
+
                $context->getOutput()->sendCacheControl();
                header( "Content-Type: $wgMimeType; charset=UTF-8" );
                header( "Content-Language: $wgLanguageCode" );
@@ -113,6 +114,7 @@ class HTMLFileCache extends FileCacheBase {
                                header( 'Content-Encoding: gzip' );
                        } else {
                                /* Send uncompressed */
+                               wfDebug( __METHOD__ . " uncompressing cache file and sending it\n" );
                                readgzfile( $filename );
                                return;
                        }