Only call User::getSkin() when necessary.
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 11 Mar 2011 14:31:12 +0000 (14:31 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Fri, 11 Mar 2011 14:31:12 +0000 (14:31 +0000)
(With this, a parser cache hit on action=render may not load the skin at all)

includes/Article.php
includes/OutputPage.php

index b5f4d4f..5322366 100644 (file)
@@ -1216,13 +1216,12 @@ class Article {
                global $wgOut, $wgUser, $wgRequest, $wgRedirectSources;
 
                $rdfrom = $wgRequest->getVal( 'rdfrom' );
-               $sk = $wgUser->getSkin();
 
                if ( isset( $this->mRedirectedFrom ) ) {
                        // This is an internally redirected page view.
                        // We'll need a backlink to the source page for navigation.
                        if ( wfRunHooks( 'ArticleViewRedirect', array( &$this ) ) ) {
-                               $redir = $sk->link(
+                               $redir = $wgUser->getSkin()->link(
                                        $this->mRedirectedFrom,
                                        null,
                                        array(),
@@ -1250,7 +1249,7 @@ class Article {
                        // This is an externally redirected view, from some other wiki.
                        // If it was reported from a trusted site, supply a backlink.
                        if ( $wgRedirectSources && preg_match( $wgRedirectSources, $rdfrom ) ) {
-                               $redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
+                               $redir = $wgUser->getSkin()->makeExternalLink( $rdfrom, $rdfrom );
                                $s = wfMsgExt( 'redirectedfrom', array( 'parseinline', 'replaceafter' ), $redir );
                                $wgOut->setSubtitle( $s );
 
index b953728..b7e5e9d 100644 (file)
@@ -1785,8 +1785,6 @@ class OutputPage {
                        }
                }
 
-               $sk = $wgUser->getSkin();
-
                // Add base resources
                $this->addModules( 'mediawiki.util' );
                global $wgIncludeLegacyJavaScript;
@@ -1849,6 +1847,8 @@ class OutputPage {
                if ( $this->mArticleBodyOnly ) {
                        $this->out( $this->mBodytext );
                } else {
+                       $sk = $wgUser->getSkin();
+
                        // Hook that allows last minute changes to the output page, e.g.
                        // adding of CSS or Javascript by extensions.
                        wfRunHooks( 'BeforePageDisplay', array( &$this, &$sk ) );