r46761 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46760‎ | r46761 | r46762 >
Date:12:59, 3 February 2009
Author:ialex
Status:deferred
Tags:
Comment:
Made MediaWikiFarmer::getActiveWiki() non-static and fixed static call in SpecialFarmer.php
Modified paths:
  • /trunk/extensions/Farmer/MediaWikiFarmer.php (modified) (history)
  • /trunk/extensions/Farmer/SpecialFarmer.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Farmer/SpecialFarmer.php
@@ -282,7 +282,7 @@
283283 $list = $wgFarmer->getFarmList();
284284
285285 $wgOut->wrapWikiMsg( "== $1 ==", 'farmer-listofwikis' );
286 - $current = MediaWikiFarmer::getActiveWiki()->name;
 286+ $current = $wgFarmer->getActiveWiki()->name;
287287
288288 foreach ( $list as $wiki ) {
289289 $link = ( $current == $wiki['name'] ? wfMsgForContent( 'mainpage' ) : $wiki['name'] . ':' );
Index: trunk/extensions/Farmer/MediaWikiFarmer.php
@@ -52,21 +52,17 @@
5353 protected $_sharedGroups = false;
5454 protected $_extensionsLoaded = false;
5555
 56+ /** Instance of MediaWikiFarmer_Wiki */
 57+ protected $_activeWiki = null;
 58+
5659 /** Instance of this class */
5760 protected static $_instance = null;
5861
59 - /** Instance of MediaWikiFarmer_Wiki */
60 - protected static $_activeWiki = null;
6162
62 -
6363 public static function getInstance() {
6464 return self::$_instance;
6565 }
6666
67 - public static function getActiveWiki() {
68 - return self::$_activeWiki;
69 - }
70 -
7167 /**
7268 * Constructor
7369 *
@@ -126,6 +122,13 @@
127123 }
128124
129125 /**
 126+ * Get the active wiki for this MediaWikiFarmer instance
 127+ */
 128+ public function getActiveWiki() {
 129+ return $this->_activeWiki;
 130+ }
 131+
 132+ /**
130133 * Runs MediaWikiFarmer
131134 *
132135 * This function does all the fun stuff
@@ -164,9 +167,8 @@
165168 */
166169 protected function _doWiki( $wiki ){
167170 $wiki = MediaWikiFarmer_Wiki::factory( $wiki );
 171+ $this->_activeWiki = $wiki;
168172
169 - self::$_activeWiki = $wiki;
170 -
171173 if( !$wiki->exists() ){
172174 // if the default wiki doesn't exist (probably first-time user)
173175 if ( $wiki->isDefaultWiki() ) {

Status & tagging log