Skip redirect checks for NS_MEDIAWIKI
authorAaron Schulz <aaron@users.mediawiki.org>
Tue, 23 Dec 2008 22:48:44 +0000 (22:48 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Tue, 23 Dec 2008 22:48:44 +0000 (22:48 +0000)
includes/Wiki.php

index 9feeb08..00fd407 100644 (file)
@@ -42,6 +42,7 @@ class MediaWiki {
        /**
         * Initialization of ... everything
         * Performs the request too
+        * FIXME: why is this crap called "initialize" when it performs everything?
         *
         * @param $title Title ($wgTitle)
         * @param $article Article
@@ -85,7 +86,6 @@ class MediaWiki {
                }
        }
 
-
        /**
         * Checks some initial queries
         * Note that $title here is *not* a Title object, but a string!
@@ -157,6 +157,8 @@ class MediaWiki {
         * - redirect loop
         * - special pages
         *
+        * FIXME: why is this crap called "initialize" when it performs everything?
+        *
         * @param $title Title
         * @param $output OutputPage
         * @param $request WebRequest
@@ -286,9 +288,14 @@ class MediaWiki {
        function initializeArticle( &$title, $request ) {
                wfProfileIn( __METHOD__ );
 
-               $action = $this->getVal( 'action' );
+               $action = $this->getVal( 'action', 'view' );
                $article = self::articleFromTitle( $title );
-               
+               # NS_MEDIAWIKI has no redirects.
+               # It is also used for CSS/JS, so performance matters here...
+               if( $title->getNamespace() == NS_MEDIAWIKI ) {
+                       wfProfileOut( __METHOD__ );
+                       return $article;
+               }
                // Namespace might change when using redirects
                // Check for redirects ...
                $file = ($title->getNamespace() == NS_FILE) ? $article->getFile() : null;
@@ -317,8 +324,7 @@ class MediaWiki {
                                                return $target;
                                        }
                                }
-
-                               if( is_object( $target ) ) {
+                               if( is_object($target) ) {
                                        // Rewrite environment to redirected article
                                        $rarticle = self::articleFromTitle( $target );
                                        $rarticle->loadPageData( $rarticle->pageDataFromTitle( $dbr, $target ) );