Speed up filecache a tad
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 9 Dec 2008 11:41:31 +0000 (11:41 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 9 Dec 2008 11:41:31 +0000 (11:41 +0000)
includes/Article.php

index cbed4d5..07fce76 100644 (file)
@@ -674,7 +674,6 @@ class Article {
                global $wgEnableParserCache, $wgStylePath, $wgParser;
                global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies;
                global $wgDefaultRobotPolicy;
-               $sk = $wgUser->getSkin();
 
                wfProfileIn( __METHOD__ );
 
@@ -684,6 +683,23 @@ class Article {
                # Get variables from query string
                $oldid = $this->getOldID();
 
+               # Try file cache
+               if( $oldid === 0 && $this->checkTouched() ) {
+                       $wgOut->setETag($parserCache->getETag($this, $wgUser));
+                       if( $wgOut->checkLastModified( $this->getTouched() ) ){
+                               wfProfileOut( __METHOD__ );
+                               return;
+                       } else if( $this->tryFileCache() ) {
+                               # tell wgOut that output is taken care of
+                               $wgOut->disable();
+                               $this->viewUpdates();
+                               wfProfileOut( __METHOD__ );
+                               return;
+                       }
+               }
+
+               $sk = $wgUser->getSkin();
+
                # getOldID may want us to redirect somewhere else
                if( $this->mRedirectUrl ) {
                        $wgOut->redirect( $this->mRedirectUrl );
@@ -735,21 +751,6 @@ class Article {
                        return;
                }
 
-               if( empty( $oldid ) && $this->checkTouched() ) {
-                       $wgOut->setETag($parserCache->getETag($this, $wgUser));
-
-                       if( $wgOut->checkLastModified( $this->mTouched ) ){
-                               wfProfileOut( __METHOD__ );
-                               return;
-                       } else if( $this->tryFileCache() ) {
-                               # tell wgOut that output is taken care of
-                               $wgOut->disable();
-                               $this->viewUpdates();
-                               wfProfileOut( __METHOD__ );
-                               return;
-                       }
-               }
-
                # Should the parser cache be used?
                $pcache = $this->useParserCache( $oldid );
                wfDebug( 'Article::view using parser cache: ' . ($pcache ? 'yes' : 'no' ) . "\n" );