r111354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111353‎ | r111354 | r111355 >
Date:09:53, 13 February 2012
Author:nikerabbit
Status:ok (Comments)
Tags:
Comment:
getSkin is deprecated
Modified paths:
  • /trunk/extensions/Translate/specials/SpecialManageGroups.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Translate/specials/SpecialManageGroups.php
@@ -20,11 +20,6 @@
2121 */
2222 class SpecialManageGroups extends SpecialPage {
2323 /**
24 - * @var Skin
25 - */
26 - protected $skin;
27 -
28 - /**
2924 * @var User
3025 */
3126 protected $user;
@@ -44,12 +39,12 @@
4540 global $wgOut, $wgUser;
4641 $this->out = $wgOut;
4742 $this->user = $wgUser;
48 - $this->skin = $wgUser->getSkin();
4943 parent::__construct( 'ManageMessageGroups', 'translate-manage' );
5044 }
5145
5246 public function execute( $par ) {
5347 global $wgRequest;
 48+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
5449
5550 $this->out->setPageTitle( htmlspecialchars( wfMsg( 'translate-managegroups' ) ) );
5651
@@ -107,7 +102,7 @@
108103 wfDebug( __METHOD__ . ": {$group->getId()}\n" );
109104
110105 $id = $group->getId();
111 - $link = $this->skin->link( $this->getTitle(), $group->getLabel(),
 106+ $link = $linker->link( $this->getTitle(), $group->getLabel(),
112107 array( 'id' => "mw-group-$id" ), array( 'group' => $id ) );
113108 $out = $link . $separator;
114109
@@ -406,7 +401,8 @@
407402 if ( $code === 'en' ) {
408403 $this->doModLangs( $group );
409404 } else {
410 - $this->out->addHTML( '<p>' . $this->skin->link(
 405+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
 406+ $this->out->addHTML( '<p>' . $linker->link(
411407 $this->getTitle(),
412408 wfMsgHtml( 'translate-manage-return-to-group' ),
413409 array(),
@@ -435,7 +431,8 @@
436432 continue;
437433 }
438434
439 - $link = $this->skin->link(
 435+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
 436+ $link = $linker->link(
440437 $this->getTitle(),
441438 htmlspecialchars( TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() ) . " ($code)" ),
442439 array(),
@@ -485,13 +482,14 @@
486483 */
487484 protected function setSubtitle( $group, $code ) {
488485 global $wgLang;
 486+ $linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
489487
490 - $links[] = $this->skin->link(
 488+ $links[] = $linker->link(
491489 $this->getTitle(),
492490 wfMsgHtml( 'translate-manage-subtitle' )
493491 );
494492
495 - $links[] = $this->skin->link(
 493+ $links[] = $linker->link(
496494 $this->getTitle(),
497495 htmlspecialchars( $group->getLabel() ),
498496 array(),
@@ -501,7 +499,7 @@
502500 // Do not show language part for English.
503501 if ( $code !== 'en' ) {
504502 $langname = TranslateUtils::getLanguageName( $code, false, $wgLang->getCode() );
505 - $links[] = $this->skin->link(
 503+ $links[] = $linker->link(
506504 $this->getTitle(),
507505 htmlspecialchars( $langname ),
508506 array(),

Comments

#Comment by Awjrichards (talk | contribs)   23:03, 17 February 2012

Rather than repeat:

$linker = class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;

over and over again, perhaps do something like:

$linker = $this->getLinker();
...
function getLinker() {
  return class_exists( 'DummyLinker' ) ? new DummyLinker : new Linker;
}
#Comment by Nikerabbit (talk | contribs)   09:25, 18 February 2012

This code is only for BC for some releases, after which it will be dropped. Doesn't seem worth it to spend more time on that than needed.

Status & tagging log