]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/AjaxResponse.php
MediaWiki 1.15.4-scripts
[autoinstalls/mediawiki.git] / includes / AjaxResponse.php
index 8fa08539a6ef651ca201b1fc4608e518e559d507..26b6f443981e86f57de444bbce1326feffde7c7d 100644 (file)
@@ -1,11 +1,18 @@
 <?php
+/**
+ * @file
+ * @ingroup Ajax
+ */
+
 if( !defined( 'MEDIAWIKI' ) ) {
        die( 1 );
 }
 
 /**
- * @todo document
- * @addtogroup Ajax
+ * Handle responses for Ajax requests (send headers, print
+ * content, that sort of thing)
+ * 
+ * @ingroup Ajax
  */
 class AjaxResponse {
 
@@ -15,7 +22,7 @@ class AjaxResponse {
        /** HTTP header Content-Type */
        private $mContentType;
 
-       /** @todo document */
+       /** Disables output. Can be set by calling $AjaxResponse->disable() */
        private $mDisabled;
 
        /** Date for the HTTP header Last-modified */
@@ -38,7 +45,7 @@ class AjaxResponse {
                $this->mText = '';
                $this->mResponseCode = '200 OK';
                $this->mLastModified = false;
-               $this->mContentType= 'text/html; charset=utf-8';
+               $this->mContentType= 'application/x-wiki';
 
                if ( $text ) {
                        $this->addText( $text );
@@ -99,7 +106,7 @@ class AjaxResponse {
 
                if ( $this->mCacheDuration ) {
 
-                       # If squid caches are configured, tell them to cache the response, 
+                       # If squid caches are configured, tell them to cache the response,
                        # and tell the client to always check with the squid. Otherwise,
                        # tell the client to use a cached copy, without a way to purge it.
 
@@ -171,6 +178,7 @@ class AjaxResponse {
                        wfDebug( "$fname: -- client send If-Modified-Since: " . $modsince . "\n", false );
                        wfDebug( "$fname: --  we might send Last-Modified : $lastmod\n", false );
                        if( ($ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
+                               ini_set('zlib.output_compression', 0);
                                $this->setResponseCode( "304 Not Modified" );
                                $this->disable();
                                $this->mLastModified = $lastmod;
@@ -220,4 +228,3 @@ class AjaxResponse {
                return true;
        }
 }
-