From 08861c5638ac46b021230ea7e26442450dcfac6f Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Fri, 11 Mar 2011 14:31:12 +0000 Subject: [PATCH] Only call User::getSkin() when necessary. (With this, a parser cache hit on action=render may not load the skin at all) --- includes/Article.php | 5 ++--- includes/OutputPage.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/includes/Article.php b/includes/Article.php index b5f4d4f8e2..5322366f93 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -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 ); diff --git a/includes/OutputPage.php b/includes/OutputPage.php index b953728c50..b7e5e9d064 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -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 ) ); -- 2.20.1