Hide title if DELETED_ACTION is on, but don't worry about type/action, which isn...
[lhc/web/wiklou.git] / includes / RawPage.php
index 9640cee..b422d49 100644 (file)
@@ -34,7 +34,7 @@ class RawPage {
                }
 
                $ctype = $this->mRequest->getVal( 'ctype' );
-               $smaxage = $this->mRequest->getIntOrNull( 'smaxage', $wgSquidMaxage );
+               $smaxage = $this->mRequest->getIntOrNull( 'smaxage' );
                $maxage = $this->mRequest->getInt( 'maxage', $wgSquidMaxage );
 
                $this->mExpandTemplates = $this->mRequest->getVal( 'templates' ) === 'expand';
@@ -127,6 +127,15 @@ class RawPage {
                        $url = $_SERVER['PHP_SELF'];
                }
 
+               if( $url == '' ) {
+                       # This will make the next check fail with a confusing error
+                       # message, so we should mention it separately.
+                       wfHttpError( 500, 'Internal Server Error',
+                               "\$_SERVER['PHP_SELF'] is not set.  Perhaps you're using CGI" .
+                               " and haven't set cgi.fix_pathinfo = 1 in php.ini?" );
+                       return;
+               }
+
                if( strcmp( $wgScript, $url ) ) {
                        # Internet Explorer will ignore the Content-Type header if it
                        # thinks it sees a file extension it recognizes. Make sure that
@@ -151,12 +160,10 @@ class RawPage {
                header( 'Cache-Control: '.$mode.', s-maxage='.$this->mSmaxage.', max-age='.$this->mMaxage );
                
                if( HTMLFileCache::useFileCache() ) {
-                       $cache = new HTMLFileCache( $this->mTitle );
+                       $cache = new HTMLFileCache( $this->mTitle, 'raw' );
                        if( $cache->isFileCacheGood( /* Assume up to date */ ) ) {
-                               /* Check incoming headers to see if client has this cached */
-                               if( !$wgOut->checkLastModified( $cache->fileCacheTime() ) ) {
-                                       $cache->loadFromFileCache();
-                               }
+                               $cache->loadFromFileCache();
+                               $wgOut->disable();
                                return;
                        } else {
                                ob_start( array(&$cache, 'saveToFileCache' ) );
@@ -166,7 +173,7 @@ class RawPage {
                $text = $this->getRawText();
 
                if( !wfRunHooks( 'RawPageViewBeforeOutput', array( &$this, &$text ) ) ) {
-                       wfDebug( __METHOD__ . ': RawPageViewBeforeOutput hook broke raw page output.' );
+                       wfDebug( __METHOD__ . ": RawPageViewBeforeOutput hook broke raw page output.\n" );
                }
 
                echo $text;