r112014 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112013‎ | r112014 | r112015 >
Date:13:41, 21 February 2012
Author:siebrand
Status:ok (Comments)
Tags:
Comment:
Remove some no longer needed uses of User::getSkin(). Use static linker method instead.
Modified paths:
  • /trunk/extensions/Translate/specials/SpecialFirstSteps.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialSupportedLanguages.php (modified) (history)
  • /trunk/extensions/Translate/specials/SpecialTranslations.php (modified) (history)
  • /trunk/extensions/Translate/tag/SpecialPageTranslation.php (modified) (history)
  • /trunk/extensions/Translate/utils/ToolBox.php (modified) (history)
  • /trunk/extensions/Translate/utils/TranslationHelpers.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/tag/SpecialPageTranslation.php
@@ -442,7 +442,7 @@
443443 public function showPage( TranslatablePage $page, Array $sections ) {
444444 global $wgOut, $wgContLang;
445445
446 - $wgOut->setSubtitle( $this->user->getSkin()->link( $page->getTitle() ) );
 446+ $wgOut->setSubtitle( Linker::link( $page->getTitle() ) );
447447 $wgOut->addModules( 'ext.translate.special.pagetranslation' );
448448
449449 $wgOut->addWikiMsg( 'tpt-showpage-intro' );
Index: trunk/extensions/Translate/utils/TranslationHelpers.php
@@ -1152,13 +1152,11 @@
11531153 * @return string
11541154 */
11551155 protected function doBox( $msg, $code, $title = false, $makelink = false ) {
1156 - global $wgUser, $wgLang;
 1156+ global $wgLang;
11571157
11581158 $name = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
11591159 $code = wfBCP47( $code );
11601160
1161 - $skin = $wgUser->getSkin();
1162 -
11631161 $attributes = array();
11641162 if ( !$title ) {
11651163 $attributes['class'] = 'mw-sp-translate-in-other-big';
@@ -1180,7 +1178,7 @@
11811179
11821180 if ( $makelink ) {
11831181 $linkTitle = Title::newFromText( $makelink );
1184 - $title = $skin->link(
 1182+ $title = Linker::link(
11851183 $linkTitle,
11861184 htmlspecialchars( $title ),
11871185 array(),
Index: trunk/extensions/Translate/utils/ToolBox.php
@@ -25,6 +25,7 @@
2626 static function toolboxAllTranslations( &$skin ) {
2727 global $wgTranslateMessageNamespaces;
2828
 29+ // @todo Remove BC code.
2930 if ( method_exists( $skin, 'getSkin' ) ) {
3031 $title = $skin->getSkin()->getTitle();
3132 } else {
Index: trunk/extensions/Translate/specials/SpecialSupportedLanguages.php
@@ -77,10 +77,7 @@
7878 $this->preQueryUsers( $users );
7979
8080 list( $editcounts, $lastedits ) = $this->getUserStats();
81 - global $wgUser;
8281
83 - $skin = $wgUser->getSkin();
84 -
8582 // Information to be used inside the foreach loop.
8683 $linkInfo['rc']['title'] = SpecialPage::getTitleFor( 'Recentchanges' );
8784 $linkInfo['rc']['msg'] = wfMsg( 'supportedlanguages-recenttranslations' );
@@ -103,7 +100,7 @@
104101 $wgOut->addHtml( Html::openElement( 'h2', array( 'id' => $code ) ) );
105102 if ( defined( 'NS_PORTAL' ) ) {
106103 $portalTitle = Title::makeTitleSafe( NS_PORTAL, $code );
107 - $wgOut->addHtml( $skin->linkKnown( $portalTitle, $headerText ) );
 104+ $wgOut->addHtml( Linker::linkKnown( $portalTitle, $headerText ) );
108105 } else {
109106 $wgOut->addHtml( $headerText );
110107 }
@@ -112,7 +109,7 @@
113110
114111 // Add useful links for language stats and recent changes for the language.
115112 $links = array();
116 - $links[] = $skin->link(
 113+ $links[] = Linker::link(
117114 $linkInfo['stats']['title'],
118115 $linkInfo['stats']['msg'],
119116 array(),
@@ -122,7 +119,7 @@
123120 ),
124121 array( 'known', 'noclasses' )
125122 );
126 - $links[] = $skin->link(
 123+ $links[] = Linker::link(
127124 $linkInfo['rc']['title'],
128125 $linkInfo['rc']['msg'],
129126 array(),
@@ -270,8 +267,7 @@
271268 }
272269
273270 protected function makeUserList( $users, $editcounts, $lastedits ) {
274 - global $wgOut, $wgLang, $wgUser;
275 - $skin = $wgUser->getSkin();
 271+ global $wgOut, $wgLang;
276272
277273 $day = 60 * 60 * 24;
278274
@@ -306,7 +302,7 @@
307303 $stylestr = $this->formatStyle( $styles );
308304 if ( $stylestr ) $attribs['style'] = $stylestr;
309305
310 - $links[] = $skin->link( $title, $enc, $attribs );
 306+ $links[] = Linker::link( $title, $enc, $attribs );
311307 }
312308
313309 $wgOut->addHTML( "<p class='mw-translate-spsl-translators'>" . wfMsgExt(
Index: trunk/extensions/Translate/specials/SpecialTranslations.php
@@ -136,8 +136,6 @@
137137 function showTranslations( Title $title ) {
138138 global $wgOut, $wgUser, $wgLang;
139139
140 - $sk = $wgUser->getSkin();
141 -
142140 $namespace = $title->getNamespace();
143141 $message = $title->getDBkey();
144142
@@ -212,10 +210,10 @@
213211 $text
214212 );
215213 } else {
216 - $tools['edit'] = $sk->link( $tTitle, $text );
 214+ $tools['edit'] = Linker::link( $tTitle, $text );
217215 }
218216
219 - $tools['history'] = $sk->link(
 217+ $tools['history'] = Linker::link(
220218 $tTitle,
221219 $historyText,
222220 array(
Index: trunk/extensions/Translate/specials/SpecialFirstSteps.php
@@ -16,13 +16,7 @@
1717 * @ingroup SpecialPage TranslateSpecialPage
1818 */
1919 class SpecialFirstSteps extends UnlistedSpecialPage {
20 -
2120 /**
22 - * @var Skin
23 - */
24 - protected $skin;
25 -
26 - /**
2721 * @var User
2822 */
2923 protected $user;
@@ -40,7 +34,6 @@
4135 global $wgOut, $wgUser;
4236 $this->out = $wgOut;
4337 $this->user = $wgUser;
44 - $this->skin = $wgUser->getSkin();
4538
4639 $this->out->addWikiMsg( 'translate-fs-intro' );
4740 $step = false;

Follow-up revisions

RevisionCommit summaryAuthorDate
r112425Follow-up r112014: Remove 1.17 BC linker usage.siebrand12:02, 26 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   14:10, 21 February 2012

Would you like to convert the instances of DummyLinker as well?

Status & tagging log