r50839 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50838‎ | r50839 | r50840 >
Date:22:19, 20 May 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* add right- messages
* remove trailing whitespace, update indentation, stylize.php
* bump version
Modified paths:
  • /trunk/extensions/Farmer/Farmer.i18n.php (modified) (history)
  • /trunk/extensions/Farmer/Farmer.php (modified) (history)
  • /trunk/extensions/Farmer/MediaWikiFarmer.php (modified) (history)
  • /trunk/extensions/Farmer/MediaWikiFarmer_Extension.php (modified) (history)
  • /trunk/extensions/Farmer/MediaWikiFarmer_Wiki.php (modified) (history)
  • /trunk/extensions/Farmer/SpecialFarmer.php (modified) (history)
  • /trunk/extensions/Farmer/farmer.sql (modified) (history)

Diff [purge]

Index: trunk/extensions/Farmer/Farmer.i18n.php
@@ -137,6 +137,8 @@
138138 'farmer-log-header' => 'This is a log of changes made to the wiki farm.',
139139 'farmer-log-create' => 'created the wiki "$2"',
140140 'farmer-log-delete' => 'deleted the wiki "$2"',
 141+ 'right-farmeradmin' => 'Manage the wiki farm',
 142+ 'right-createwiki' => 'Create wikis in the wiki farm',
141143 );
142144
143145 /** Message documentation (Message documentation)
Index: trunk/extensions/Farmer/Farmer.php
@@ -19,17 +19,17 @@
2020 'url' => 'http://www.mediawiki.org/wiki/Extension:Farmer',
2121 'description' => 'Manage a MediaWiki farm',
2222 'descriptionmsg' => 'farmer-desc',
23 - 'version' => '0.0.6',
 23+ 'version' => '0.0.7',
2424 );
2525
2626 /**
2727 * Extension's configuration
2828 */
2929 $wgFarmerSettings = array(
30 - //Path to the directory that holds settings for wikis
 30+ // Path to the directory that holds settings for wikis
3131 'configDirectory' => realpath( dirname( __FILE__ ) ) . '/configs/',
3232
33 - //Or use a database
 33+ // Or use a database
3434 'databaseName' => null,
3535
3636 // Default wiki
Index: trunk/extensions/Farmer/MediaWikiFarmer_Extension.php
@@ -11,9 +11,9 @@
1212 protected $_description;
1313 protected $_id;
1414
15 - /**
16 - * List of files that need to be included for this extension to work
17 - */
 15+ /**
 16+ * List of files that need to be included for this extension to work
 17+ */
1818 protected $_includeFiles = array();
1919
2020 public static function newFromRow( $row ) {
@@ -43,7 +43,7 @@
4444 * open them
4545 */
4646 public function isValid() {
47 - foreach( $this->_includeFiles as $file ) {
 47+ foreach ( $this->_includeFiles as $file ) {
4848 $result = @fopen( $file, 'r', true );
4949
5050 if ( $result === false ) return false;
Index: trunk/extensions/Farmer/SpecialFarmer.php
@@ -18,7 +18,6 @@
1919 public function __construct() {
2020 parent::__construct( 'Farmer' );
2121 wfLoadExtensionMessages( 'MediaWikiFarmer' );
22 -
2322 }
2423
2524 /**
@@ -43,14 +42,14 @@
4443 $this->_executeUpdateList( $wgFarmer );
4544 } elseif ( $arr[0] == 'list' ) {
4645 $this->_executeList( $wgFarmer );
47 - } elseif ( $arr[0] == 'admin') {
 46+ } elseif ( $arr[0] == 'admin' ) {
4847 $this->_executeAdminister( $wgFarmer );
49 - } elseif ( $arr[0] == 'delete') {
 48+ } elseif ( $arr[0] == 'delete' ) {
5049 $this->_executeDelete( $wgFarmer );
5150 }
5251 } else {
53 - //no parameters were given
54 - //display the main page
 52+ // no parameters were given
 53+ // display the main page
5554
5655 $this->_executeMainPage( $wgFarmer );
5756 }
@@ -75,7 +74,7 @@
7675 $wgOut->wrapWikiMsg( '* $1', array( 'farmer-createwiki-text', 'Special:Farmer/create' ) );
7776 }
7877
79 - //if the user is a farmer admin, give them a menu of cool admin tools
 78+ // if the user is a farmer admin, give them a menu of cool admin tools
8079 if ( MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ) {
8180 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-administration' );
8281 $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-administration-extension' );
@@ -86,7 +85,6 @@
8786
8887 $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-administration-delete' );
8988 $wgOut->wrapWikiMsg( '* $1', array( 'farmer-administration-delete-text', 'Special:Farmer/delete' ) );
90 -
9189 }
9290 }
9391
@@ -96,24 +94,21 @@
9795 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-administer-thiswiki' );
9896 $wgOut->wrapWikiMsg( '* $1', array( 'farmer-administer-thiswiki-text', 'Special:Farmer/admin' ) );
9997 }
100 -
101 -
102 -
10398 }
10499
105100 /**
106101 * Displays form to create wiki
107102 */
108 - protected function _executeCreate( $wgFarmer, $wiki ){
 103+ protected function _executeCreate( $wgFarmer, $wiki ) {
109104 global $wgOut, $wgUser, $wgRequest;
110105
111 - if( !$wgFarmer->getActiveWiki()->isDefaultWiki() ) {
 106+ if ( !$wgFarmer->getActiveWiki()->isDefaultWiki() ) {
112107 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-notavailable' );
113108 $wgOut->addWikiMsg( 'farmer-notavailable-text' );
114109 return;
115110 }
116111
117 - if( !MediaWikiFarmer::userCanCreateWiki( $wgUser, $wiki ) ){
 112+ if ( !MediaWikiFarmer::userCanCreateWiki( $wgUser, $wiki ) ) {
118113 $wgOut->addWikiMsg( 'farmercantcreatewikis' );
119114 return;
120115 }
@@ -124,10 +119,10 @@
125120 $reason = $wgRequest->getVal( 'wpReason' );
126121 $action = $this->getTitle( 'create' )->escapeLocalURL();
127122
128 - //if something was POST'd
129 - if( $wgRequest->wasPosted() ){
130 - //we create the wiki if the user pressed 'Confirm'
131 - if( $wgRequest->getCheck( 'wpConfirm' ) ) {
 123+ // if something was POST'd
 124+ if ( $wgRequest->wasPosted() ) {
 125+ // we create the wiki if the user pressed 'Confirm'
 126+ if ( $wgRequest->getCheck( 'wpConfirm' ) ) {
132127 $wikiObj = MediaWikiFarmer_Wiki::newFromParams( $name, $title, $description, $wgUser->getName() );
133128 $wikiObj->create();
134129
@@ -136,14 +131,14 @@
137132
138133 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-wikicreated' );
139134 $wgOut->addWikiMsg( 'farmer-wikicreated-text', $wikiObj->getUrl( wfUrlencode( wfMsgNoDB( 'mainpage' ) ) ) );
140 - $wgOut->addWikiMsg( 'farmer-default', '[['.$title.':Special:Farmer|Special:Farmer]]' );
 135+ $wgOut->addWikiMsg( 'farmer-default', '[[' . $title . ':Special:Farmer|Special:Farmer]]' );
141136 return;
142137 }
143138
144 - if( $name && $title && $description ){
 139+ if ( $name && $title && $description ) {
145140 $wiki = new MediaWikiFarmer_Wiki( $name );
146141
147 - if( $wiki->exists() || $wiki->databaseExists() ){
 142+ if ( $wiki->exists() || $wiki->databaseExists() ) {
148143 $wgOut->wrapWikiMsg( "== $1 ==\n\n$2", 'farmer-wikiexists', array( 'farmer-wikiexists-text', $name ) );
149144 return;
150145 }
@@ -168,7 +163,7 @@
169164 $nametitle = htmlspecialchars( $title );
170165 $namedescript = htmlspecialchars( $description );
171166 $confirmaccount = wfMsgHtml( 'farmer-button-confirm' );
172 - $wgOut->addHTML("
 167+ $wgOut->addHTML( "
173168
174169 <form id=\"farmercreate2\" method=\"post\" action=\"$action\">
175170 <input type=\"hidden\" name=\"wpName\" value=\"{$nameaccount}\" />
@@ -180,7 +175,6 @@
181176 );
182177
183178 return;
184 -
185179 }
186180 }
187181
@@ -204,7 +198,7 @@
205199
206200 $token = htmlspecialchars( $wgUser->editToken() );
207201
208 - $wgOut->addHTML(
 202+ $wgOut->addHTML(
209203 Xml::openElement( 'form', array( 'method' => 'post', 'action' => $action ) ) . "\n" .
210204 Xml::buildForm(
211205 array(
@@ -223,7 +217,7 @@
224218 protected function _executeUpdateList( $wgFarmer ) {
225219 global $wgUser, $wgOut;
226220
227 - if( !MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ){
 221+ if ( !MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ) {
228222 $wgOut->permissionRequired( 'farmeradmin' );
229223 return;
230224 }
@@ -234,21 +228,21 @@
235229 $wgOut->returnToMain( null, $this->getTitle() );
236230 }
237231
238 - protected function _executeDelete( $wgFarmer ){
 232+ protected function _executeDelete( $wgFarmer ) {
239233 global $wgOut, $wgUser, $wgRequest;
240234
241 - if( !$wgFarmer->getActiveWiki()->isDefaultWiki() ){
 235+ if ( !$wgFarmer->getActiveWiki()->isDefaultWiki() ) {
242236 $wgOut->wrapWikiMsg( "== $1 ==\n$2", 'farmer-notaccessible', 'farmer-notaccessible-test' );
243237 return;
244238 }
245239
246 - if( !MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ){
 240+ if ( !MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) ) {
247241 $wgOut->wrapWikiMsg( "== $1 ==\n$2", 'farmer-permissiondenied', 'farmer-permissiondenied-text' );
248242 return;
249243 }
250244
251 - if( $wgRequest->wasPosted() && ( $wiki = $wgRequest->getVal( 'wpWiki' ) ) && $wiki != '-1' ) {
252 - if( $wgRequest->getCheck( 'wpConfirm' ) ) {
 245+ if ( $wgRequest->wasPosted() && ( $wiki = $wgRequest->getVal( 'wpWiki' ) ) && $wiki != '-1' ) {
 246+ if ( $wgRequest->getCheck( 'wpConfirm' ) ) {
253247 $wgOut->wrapWikiMsg( '<div class="successbox">$1</div>', array( 'farmer-deleting', $wiki ) );
254248
255249 $log = new LogPage( 'farmer' );
@@ -278,7 +272,7 @@
279273 $select = new XmlSelect( 'wpWiki', false, $wgRequest->getVal( 'wpWiki' ) );
280274 $select->addOption( wfMsg( 'farmer-delete-form' ), '-1' );
281275 foreach ( $list as $wiki ) {
282 - if( $wiki['name'] != $wgFarmer->getDefaultWiki() ) {
 276+ if ( $wiki['name'] != $wgFarmer->getDefaultWiki() ) {
283277 $name = $wiki['name'];
284278 $title = $wiki['title'];
285279 $select->addOption( "$name - $title", $name );
@@ -291,10 +285,9 @@
292286 Xml::submitButton( wfMsg( 'farmer-delete-form-submit' ) ) . "\n" .
293287 Xml::closeElement( 'form' )
294288 );
295 -
296289 }
297290
298 - protected function _executeList( $wgFarmer ){
 291+ protected function _executeList( $wgFarmer ) {
299292 global $wgOut;
300293
301294 $list = $wgFarmer->getFarmList();
@@ -304,7 +297,7 @@
305298
306299 foreach ( $list as $wiki ) {
307300 $link = ( $current == $wiki['name'] ? wfMsgForContent( 'mainpage' ) : $wiki['name'] . ':' );
308 - $wgOut->addWikiText( '; [[' . $link .'|'.$wiki['title'].']] : ' . $wiki['description'] );
 301+ $wgOut->addWikiText( '; [[' . $link . '|' . $wiki['title'] . ']] : ' . $wiki['description'] );
309302 }
310303 }
311304
@@ -315,7 +308,7 @@
316309
317310 $action = $this->getTitle( 'admin' )->escapeLocalURL();
318311
319 - if( !( MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) || $currentWiki->userIsAdmin( $wgUser ) ) ) {
 312+ if ( !( MediaWikiFarmer::userIsFarmerAdmin( $wgUser ) || $currentWiki->userIsAdmin( $wgUser ) ) ) {
320313 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-permissiondenied' );
321314 $wgOut->addWikiMsg( 'farmer-permissiondenied-text1' );
322315 return;
@@ -342,9 +335,9 @@
343336 $wgOut->addWikiMsg( 'farmer-basic-title1-text' );
344337
345338 $wgOut->addHTML(
346 - '<form method="post" name="wikiTitle" action="'.$action.'">' .
347 - '<input name="wikiTitle" size="30" value="'. $wiki->title . '" />' .
348 - '<input type="submit" name="submit" value="'.wfMsgHtml( 'farmer-button-submit' ).'" />' .
 339+ '<form method="post" name="wikiTitle" action="' . $action . '">' .
 340+ '<input name="wikiTitle" size="30" value="' . $wiki->title . '" />' .
 341+ '<input type="submit" name="submit" value="' . wfMsgHtml( 'farmer-button-submit' ) . '" />' .
349342 '</form>'
350343 );
351344 }
@@ -353,22 +346,22 @@
354347 $wgOut->addWikiMsg( 'farmer-basic-description-text' );
355348
356349 $wgOut->addHTML(
357 - '<form method="post" name="wikiDescription" action="'.$action.'">'.
358 - '<textarea name="wikiDescription" rows="5" cols="30">'.htmlspecialchars( $wiki->description ).'</textarea>'.
359 - '<input type="submit" name="submit" value="'.wfMsgHtml( 'farmer-button-submit' ).'" />'.
 350+ '<form method="post" name="wikiDescription" action="' . $action . '">' .
 351+ '<textarea name="wikiDescription" rows="5" cols="30">' . htmlspecialchars( $wiki->description ) . '</textarea>' .
 352+ '<input type="submit" name="submit" value="' . wfMsgHtml( 'farmer-button-submit' ) . '" />' .
360353 '</form>'
361354 );
362355
363356 # Permissions stuff
364357 if ( wfRunHooks( 'FarmerAdminPermissions', array( $wgFarmer ) ) ) {
365358
366 - # Import
 359+ # Import
367360 if ( $wgRequest->wasPosted() && $permissions = $wgRequest->getArray( 'permission' ) ) {
368361 foreach ( $permissions['*'] as $k => $v ) {
369362 $wiki->setPermissionForAll( $k, $v );
370363 }
371364
372 - foreach ($permissions['user'] as $k => $v) {
 365+ foreach ( $permissions['user'] as $k => $v ) {
373366 $wiki->setPermissionForUsers( $k, $v );
374367 }
375368
@@ -379,9 +372,9 @@
380373 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-basic-permission' );
381374 $wgOut->addWikiMsg( 'farmer-basic-permission-text' );
382375
383 - $wgOut->addHTML( '<form method="post" name="permissions" action="'.$action.'">' );
 376+ $wgOut->addHTML( '<form method="post" name="permissions" action="' . $action . '">' );
384377
385 - $wgOut->wrapWikiMsg('=== $1 ===', 'farmer-basic-permission-visitor' );
 378+ $wgOut->wrapWikiMsg( '=== $1 ===', 'farmer-basic-permission-visitor' );
386379 $wgOut->addWikiMsg( 'farmer-basic-permission-visitor-text' );
387380
388381 $doArray = array(
@@ -409,11 +402,11 @@
410403 array( 'minoredit', wfMsg( 'farmer-basic-permission-minoredit' ) )
411404 );
412405
413 - foreach( $doArray as $arr ) {
 406+ foreach ( $doArray as $arr ) {
414407 $this->_doPermissionInput( $wgOut, $wiki, 'user', $arr[0], $arr[1] );
415408 }
416409
417 - $wgOut->addHTML('<input type="submit" name="setPermissions" value="'.wfMsg( 'farmer-setpermission' ).'" />');
 410+ $wgOut->addHTML( '<input type="submit" name="setPermissions" value="' . wfMsg( 'farmer-setpermission' ) . '" />' );
418411 $wgOut->addHTML( "</form>\n\n\n" );
419412 }
420413
@@ -438,17 +431,17 @@
439432 $skins = Skin::getSkinNames();
440433 global $wgSkipSkins;
441434
442 - foreach( $wgSkipSkins as $skin ) {
 435+ foreach ( $wgSkipSkins as $skin ) {
443436 if ( array_key_exists( $skin, $skins ) ) {
444437 unset( $skins[$skin] );
445438 }
446439 }
447440
448 - $wgOut->addHTML( '<form method="post" name="formDefaultSkin" action="'.$action.'">' );
 441+ $wgOut->addHTML( '<form method="post" name="formDefaultSkin" action="' . $action . '">' );
449442
450443 foreach ( $skins as $k => $skin ) {
451 - $toAdd = '<input type="radio" name="defaultSkin" value="'.$k.'"';
452 - if ($k == $defaultSkin) {
 444+ $toAdd = '<input type="radio" name="defaultSkin" value="' . $k . '"';
 445+ if ( $k == $defaultSkin ) {
453446 $toAdd .= ' checked="checked" ';
454447 }
455448 $toAdd .= '/>' . $skin;
@@ -464,30 +457,30 @@
465458
466459 $extensions = $wgFarmer->getExtensions();
467460
468 - //if we post a list of new extensions, wipe the old list from the wiki
 461+ // if we post a list of new extensions, wipe the old list from the wiki
469462 if ( $wgRequest->wasPosted() && $wgRequest->getCheck( 'submitExtension' ) ) {
470463 $wiki->extensions = array();
471 -
472 - //go through all posted extensions and add the appropriate ones
473 - foreach( (array)$wgRequest->getArray( 'extension' ) as $k => $e ) {
 464+
 465+ // go through all posted extensions and add the appropriate ones
 466+ foreach ( (array)$wgRequest->getArray( 'extension' ) as $k => $e ) {
474467 if ( array_key_exists( $k, $extensions ) ) {
475468 $wiki->addExtension( $extensions[$k] );
476469 }
477470 }
478 -
 471+
479472 $wiki->save();
480473 }
481474
482475 # Form
483476 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-extensions' );
484 - $wgOut->addHTML( '<form method="post" name="formActiveExtensions" action="'.$action.'">' );
 477+ $wgOut->addHTML( '<form method="post" name="formActiveExtensions" action="' . $action . '">' );
485478
486479 foreach ( $extensions as $extension ) {
487 - $toAdd = '<input type="checkbox" name="extension['.$extension->name.']" ';
 480+ $toAdd = '<input type="checkbox" name="extension[' . $extension->name . ']" ';
488481 if ( $wiki->hasExtension( $extension ) ) {
489482 $toAdd .= 'checked="checked" ';
490483 }
491 - $toAdd .=' /><strong>'.htmlspecialchars( $extension->name ) . '</strong> - ' . htmlspecialchars( $extension->description ) . "<br />\n";
 484+ $toAdd .= ' /><strong>' . htmlspecialchars( $extension->name ) . '</strong> - ' . htmlspecialchars( $extension->description ) . "<br />\n";
492485 $wgOut->addHTML( $toAdd );
493486 }
494487
@@ -530,7 +523,6 @@
531524 }
532525 }
533526
534 -
535527 $wgOut->wrapWikiMsg( '== $1 ==', 'farmer-extensions-available' );
536528
537529 $extensions = $wgFarmer->getExtensions();
@@ -553,34 +545,33 @@
554546 $wgOut->addWikiText( '*' . $path );
555547 }
556548
557 - $wgOut->addHTML("
 549+ $wgOut->addHTML( "
558550 <form id=\"registerExtension\" method=\"post\">
559551 <table>
560552 <tr>
561 - <td align=\"right\">".wfMsgHtml( 'farmer-extensions-register-name' )."</td>
 553+ <td align=\"right\">" . wfMsgHtml( 'farmer-extensions-register-name' ) . "</td>
562554 <td align=\"left\"><input type=\"text\" size=\"20\" name=\"name\" value=\"\" /></td>
563555 </tr>
564556 <tr>
565 - <td align=\"right\">".wfMsgHtml( 'farmer-description' )."</td>
 557+ <td align=\"right\">" . wfMsgHtml( 'farmer-description' ) . "</td>
566558 <td align=\"left\"><input type=\"text\" size=\"50\" name=\"description\" value=\"\" /></td>
567559 </tr>
568560 <tr>
569 - <td align=\"right\">".wfMsgHtml( 'farmer-extensions-register-includefile' )."</td>
 561+ <td align=\"right\">" . wfMsgHtml( 'farmer-extensions-register-includefile' ) . "</td>
570562 <td align=\"left\"><input type=\"text\" size=\"50\" name=\"include\" value=\"\" /></td>
571563 </tr>
572564 <tr>
573565 <td>&nbsp;</td>
574 - <td align=\"right\"><input type=\"submit\" name=\"submit\" value=\"".wfMsgHtml( 'farmer-button-submit' )."\" /></td>
 566+ <td align=\"right\"><input type=\"submit\" name=\"submit\" value=\"" . wfMsgHtml( 'farmer-button-submit' ) . "\" /></td>
575567 </tr>
576568 </table>
577 -</form>");
578 -
 569+</form>" );
579570 }
580571
581572 /**
582573 * Creates form element representing an individual permission
583574 */
584 - protected function _doPermissionInput( $wgOut, &$wiki, $group, $permission, $description) {
 575+ protected function _doPermissionInput( $wgOut, &$wiki, $group, $permission, $description ) {
585576 $value = $wiki->getPermission( $group, $permission );
586577
587578 $wgOut->addHTML( '<p>' . $description . wfMsgExt( 'colon-separator', array( 'escapenoentities' ) ) );
@@ -591,7 +582,7 @@
592583 $input .= 'checked="checked" ';
593584 }
594585
595 - $input .= ' />'.wfMsgHtml( 'farmer-yes' ).'&nbsp;&nbsp;';
 586+ $input .= ' />' . wfMsgHtml( 'farmer-yes' ) . '&nbsp;&nbsp;';
596587
597588 $wgOut->addHTML( $input );
598589
@@ -601,10 +592,8 @@
602593 $input .= 'checked="checked" ';
603594 }
604595
605 - $input .= ' />'.wfMsgHtml( 'farmer-no' );
 596+ $input .= ' />' . wfMsgHtml( 'farmer-no' );
606597
607598 $wgOut->addHTML( $input . '</p>' );
608 -
609599 }
610 -
611600 }
Index: trunk/extensions/Farmer/MediaWikiFarmer.php
@@ -5,7 +5,6 @@
66 * @author Gregory Szorc <gregory.szorc@gmail.com>
77 */
88
9 -
109 /**
1110 * This class exposes functionality for a MediaWiki farm
1211 *
@@ -61,7 +60,7 @@
6261
6362 /** Instance of MediaWikiFarmer_Wiki */
6463 protected $_activeWiki = null;
65 -
 64+
6665 /** Instance of this class */
6766 protected static $_instance = null;
6867
@@ -102,24 +101,24 @@
103102
104103 $this->_parameters = $params;
105104
106 - //register this object as the static instance
 105+ // register this object as the static instance
107106 self::$_instance = $this;
108107
109 - //if the groups table is being shared
110 - if( in_array( 'user_groups', $wgSharedTables ) ){
 108+ // if the groups table is being shared
 109+ if ( in_array( 'user_groups', $wgSharedTables ) ) {
111110 $this->_sharedGroups = true;
112111 }
113112
114113 $this->_useDatabase = ( $this->_databaseName !== null );
115114
116 - if( $this->_useDatabase ) {
 115+ if ( $this->_useDatabase ) {
117116 global $IP;
118117 require_once( "$IP/includes/GlobalFunctions.php" );
119118 } else {
120 - if( !is_dir( $this->_configDirectory ) ){
 119+ if ( !is_dir( $this->_configDirectory ) ) {
121120 throw new MWException( 'configDirectory not found: ' . $this->_configDirectory );
122121 } else {
123 - if ( !is_dir( $this->_configDirectory . '/wikis/' ) ){
 122+ if ( !is_dir( $this->_configDirectory . '/wikis/' ) ) {
124123 mkdir( $this->_configDirectory . '/wikis' );
125124 }
126125 }
@@ -127,7 +126,7 @@
128127 }
129128
130129 public function __get( $key ) {
131 - if( array_key_exists( $key, $this->_parameters ) ){
 130+ if ( array_key_exists( $key, $this->_parameters ) ) {
132131 return $this->_parameters[$key];
133132 }
134133
@@ -151,22 +150,22 @@
152151 public function run() {
153152 global $wgCommandLineMode;
154153
155 - if( !$this->_defaultWiki ) {
 154+ if ( !$this->_defaultWiki ) {
156155 throw new MWException( 'Default wiki must be set' );
157156 }
158157
159158 // first we try to find the wiki name that was accessed by calling the
160159 // appropriate function
161 - if( is_callable( $this->_matchFunction ) ){
 160+ if ( is_callable( $this->_matchFunction ) ) {
162161 $wiki = call_user_func( $this->_matchFunction, $this );
163162
164163 // if our function coudln't identify the wiki from the environment
165164 if ( !$wiki ) {
166165 // if the admin passed the --wiki option in command line mode
167166 // then use it to get the wiki
168 - if( $wgCommandLineMode && defined( 'MW_DB' ) ) {
 167+ if ( $wgCommandLineMode && defined( 'MW_DB' ) ) {
169168 $wiki = MW_DB;
170 - if( defined( 'MW_PREFIX' ) && MW_PREFIX )
 169+ if ( defined( 'MW_PREFIX' ) && MW_PREFIX )
171170 $wiki .= '-' . MW_PREFIX;
172171 } else {
173172 $wiki = $this->_defaultWiki;
@@ -191,11 +190,11 @@
192191 *
193192 * @param string $wiki Wiki to load
194193 */
195 - protected function _doWiki( $wiki ){
 194+ protected function _doWiki( $wiki ) {
196195 $wiki = MediaWikiFarmer_Wiki::factory( $wiki );
197196 $this->_activeWiki = $wiki;
198197
199 - if( !$wiki->exists() ){
 198+ if ( !$wiki->exists() ) {
200199 // if the default wiki doesn't exist (probably first-time user)
201200 if ( $wiki->isDefaultWiki() ) {
202201
@@ -204,7 +203,7 @@
205204
206205 $wiki->save();
207206
208 - if( !$wiki->exists() ){
 207+ if ( !$wiki->exists() ) {
209208 throw new MWException( 'MediaWikiFarmer could not write the default wiki configuration file.' );
210209 } else {
211210 $this->updateFarmList();
@@ -214,7 +213,7 @@
215214 // we are not dealing with the default wiki
216215
217216 // we invoke the function to be called when an unknown wiki is accessed
218 - if( is_callable( $this->_onUnknownWikiFunction ) ){
 217+ if ( is_callable( $this->_onUnknownWikiFunction ) ) {
219218 call_user_func( $this->_onUnknownWikiFunction, $this, $wiki );
220219 } else {
221220 throw new MWException( 'Could not call function: ' . print_r( $this->_onUnknownFunction, true ) );
@@ -225,7 +224,6 @@
226225 // we initialize this wiki
227226 $wiki->initialize();
228227 }
229 -
230228 }
231229
232230 # Callback functions
@@ -248,12 +246,12 @@
249247 * want to use the default wiki, as specified by the 'defaultWiki'
250248 * parameter.
251249 */
252 - protected static function _matchByURLRegExp( MediaWikiFarmer $farmer, $url = null ){
253 - if( is_null( $url ) )
 250+ protected static function _matchByURLRegExp( MediaWikiFarmer $farmer, $url = null ) {
 251+ if ( is_null( $url ) )
254252 $url = $_SERVER['REQUEST_URI'];
255253
256 - if( preg_match( $farmer->_matchRegExp, $url, $matches ) === 1 ){
257 - if( array_key_exists( $farmer->_matchOffset, $matches ) ) {
 254+ if ( preg_match( $farmer->_matchRegExp, $url, $matches ) === 1 ) {
 255+ if ( array_key_exists( $farmer->_matchOffset, $matches ) ) {
258256 return $matches[$farmer->_matchOffset];
259257 }
260258 }
@@ -272,10 +270,10 @@
273271 * @param string $url URL to match to a wiki
274272 * @return string|bool Wiki name on success. false on failure
275273 */
276 - protected static function _matchByURLHostname( MediaWikiFarmer $farmer, $url = null ){
277 - if( is_null( $url ) )
 274+ protected static function _matchByURLHostname( MediaWikiFarmer $farmer, $url = null ) {
 275+ if ( is_null( $url ) )
278276 $url = $_SERVER['REQUEST_URI'];
279 -
 277+
280278 if ( $result = parse_url( $url, PHP_URL_HOST ) ) {
281279 if ( $host = $result['host'] ) {
282280 if ( preg_match( $farmer->_matchRegExp, $host, $matches ) === 1 ) {
@@ -298,17 +296,16 @@
299297 * period
300298 *
301299 */
302 - protected static function _matchByServerName( MediaWikiFarmer $farmer ){
 300+ protected static function _matchByServerName( MediaWikiFarmer $farmer ) {
303301 $serverName = $_SERVER['SERVER_NAME'];
304302
305 - //if string ends with the suffix specified
306 - if ( substr( $serverName, -strlen( $farmer->_matchServerNameSuffix ) ) == $farmer->_matchServerNameSuffix
 303+ // if string ends with the suffix specified
 304+ if ( substr( $serverName, - strlen( $farmer->_matchServerNameSuffix ) ) == $farmer->_matchServerNameSuffix
307305 && $serverName != $farmer->_matchServerNameSuffix ) {
308 - return substr( $serverName, 0, -strlen( $farmer->_matchServerNameSuffix ) - 1 );
 306+ return substr( $serverName, 0, - strlen( $farmer->_matchServerNameSuffix ) - 1 );
309307 }
310308
311309 return false;
312 -
313310 }
314311
315312 /**
@@ -331,10 +328,9 @@
332329 /**
333330 * Returns the database table prefix, as suitable for $wgDBprefix
334331 */
335 - public function splitWikiDB( $wiki ){
 332+ public function splitWikiDB( $wiki ) {
336333 $callback = $this->_dbFromWikiFunction;
337334 return call_user_func( $callback, $this, $wiki );
338 -
339335 }
340336
341337 /**
@@ -345,8 +341,8 @@
346342 * @param $wiki String
347343 * @return Array
348344 */
349 - protected static function _prefixTable( MediaWikiFarmer $farmer, $wiki ){
350 - if( $farmer->useWgConf() ){
 345+ protected static function _prefixTable( MediaWikiFarmer $farmer, $wiki ) {
 346+ if ( $farmer->useWgConf() ) {
351347 global $wgConf;
352348 return array( $wgConf->get( 'wgDBname', $wiki ), $wgConf->get( 'wgDBprefix', $wiki ) );
353349 } else {
@@ -363,12 +359,12 @@
364360 * @return Database object
365361 */
366362 public function getDB( $type ) {
367 - if( !$this->useDatabase() )
 363+ if ( !$this->useDatabase() )
368364 throw new MWException( __METHOD__ . ' called when not using database backend.' );
369365
370366 try {
371367 $db = wfGetDB( $type, array(), $this->_databaseName );
372 - } catch( DBConnectionError $e ) {
 368+ } catch ( DBConnectionError $e ) {
373369 throw new MWException( __METHOD__ . ": impossible to connect to {$this->_databaseName} to get farm configuration." );
374370 }
375371 return $db;
@@ -425,20 +421,20 @@
426422 $dbr = $this->getDB( DB_SLAVE );
427423 $res = $dbr->select( 'farmer_extension', '*', array(), __METHOD__ );
428424 $this->_extensions = array();
429 - foreach( $res as $row ) {
 425+ foreach ( $res as $row ) {
430426 $this->_extensions[$row->fe_name] = MediaWikiFarmer_Extension::newFromRow( $row );
431427 }
432428 } else {
433 - if( is_readable( $this->_getExtensionFile() ) ) {
 429+ if ( is_readable( $this->_getExtensionFile() ) ) {
434430 $contents = file_get_contents( $this->_getExtensionFile() );
435431
436432 $extensions = unserialize( $contents );
437433
438 - if( is_array( $extensions ) ) {
 434+ if ( is_array( $extensions ) ) {
439435 $this->_extensions = $extensions;
440436 }
441437 } else {
442 - //perhaps we should throw an error or something?
 438+ // perhaps we should throw an error or something?
443439 }
444440 }
445441
@@ -458,7 +454,7 @@
459455 'fe_path' => $e->includeFiles[0],
460456 ), __METHOD__ );
461457 } else {
462 - //force reload of file
 458+ // force reload of file
463459 $this->getExtensions( true );
464460 $this->_extensions[$e->name] = $e;
465461 $this->_writeExtensions();
@@ -504,11 +500,11 @@
505501 $dbr = $this->getDB( DB_SLAVE );
506502 $res = $dbr->select( 'farmer_wiki', array( 'fw_name', 'fw_title', 'fw_description' ), array(), __METHOD__ );
507503 $arr = array();
508 - foreach( $res as $row ) {
 504+ foreach ( $res as $row ) {
509505 $arr[$row->fw_name] = array(
510506 'name' => $row->fw_name,
511507 'title' => $row->fw_title,
512 - 'description' => $row->fw_description
 508+ 'description' => $row->fw_description
513509 );
514510 }
515511 return $arr;
@@ -524,13 +520,13 @@
525521 public function updateFarmList() {
526522 if ( $this->useDatabase() )
527523 return;
528 -
 524+
529525 $directory = new DirectoryIterator( $this->_configDirectory . '/wikis/' );
530526 $wikis = array();
531527
532 - foreach( $directory as $file ) {
533 - if( !$file->isDot() && !$file->isDir() ) {
534 - if( substr( $file->getFilename(), -7 ) == '.farmer' ) {
 528+ foreach ( $directory as $file ) {
 529+ if ( !$file->isDot() && !$file->isDir() ) {
 530+ if ( substr( $file->getFilename(), -7 ) == '.farmer' ) {
535531 $base = substr( $file->getFileName(), 0, -7 );
536532 $wikis[$base] = MediaWikiFarmer_Wiki::factory( $base );
537533 }
@@ -539,7 +535,7 @@
540536
541537 $farmList = array();
542538
543 - foreach( $wikis as $k => $v ) {
 539+ foreach ( $wikis as $k => $v ) {
544540 $arr = array();
545541 $arr['name'] = $v->name;
546542 $arr['title'] = $v->title;
@@ -559,7 +555,7 @@
560556 $wikis = $this->getFarmList();
561557 $dbw = wfGetDB( DB_MASTER );
562558 $replacements = array();
563 - foreach( $wikis as $key => $stuff ){
 559+ foreach ( $wikis as $key => $stuff ) {
564560 $wiki = MediaWikiFarmer_Wiki::factory( $key );
565561 $replacements[] = array(
566562 'iw_prefix' => $wiki->name,
Index: trunk/extensions/Farmer/MediaWikiFarmer_Wiki.php
@@ -33,13 +33,13 @@
3434 /**
3535 * Creates a wiki instance from a wiki name
3636 */
37 - public function __construct( $wiki, $variables = array() ){
 37+ public function __construct( $wiki, $variables = array() ) {
3838 $this->_name = $wiki;
3939 $this->_variables = $variables;
4040 }
4141
4242 public function __get( $key ) {
43 - if( substr( $key, 0, 2 ) == 'wg' ) {
 43+ if ( substr( $key, 0, 2 ) == 'wg' ) {
4444 return isset( $this->_variables[$key] ) ? $this->_variables[$key] : null;
4545 }
4646
@@ -49,7 +49,7 @@
5050 }
5151
5252 public function __set( $k, $v ) {
53 - if( in_array( $k, array( 'name', 'title', 'description', 'creator', 'extensions' ) ) ){
 53+ if ( in_array( $k, array( 'name', 'title', 'description', 'creator', 'extensions' ) ) ) {
5454 $property = '_' . $k;
5555 $this->$property = $v;
5656 } else if ( substr( $k, 0, 2 ) == 'wg' ) {
@@ -67,10 +67,10 @@
6868 public static function factory( $wiki, $variables = array() ) {
6969 $farmer = MediaWikiFarmer::getInstance();
7070
71 - if( $farmer->useDatabase() ) {
 71+ if ( $farmer->useDatabase() ) {
7272 $dbr = $farmer->getDB( DB_SLAVE );
7373 $row = $dbr->selectRow( 'farmer_wiki', '*', array( 'fw_name' => $wiki ), __METHOD__ );
74 - if( $row === false ) {
 74+ if ( $row === false ) {
7575 return new MediaWikiFarmer_Wiki( $wiki, $variables );
7676 } else {
7777 return self::newFromRow( $row );
@@ -78,10 +78,10 @@
7979 } else {
8080 $file = self::_getWikiConfigFile( $wiki );
8181
82 - if( is_readable( $file ) ){
 82+ if ( is_readable( $file ) ) {
8383 $content = file_get_contents( $file );
8484 $obj = unserialize( $content );
85 - if( $obj instanceof MediaWikiFarmer_Wiki ){
 85+ if ( $obj instanceof MediaWikiFarmer_Wiki ) {
8686 return $obj;
8787 } else {
8888 throw new MWException( 'Stored wiki is corrupt.' );
@@ -123,7 +123,7 @@
124124 array( 'farmer_wiki_extension' => array( 'LEFT JOIN', 'fwe_extension = fe_id' ) )
125125 );
126126 $wiki->_extensions = array();
127 - foreach( $res as $row ) {
 127+ foreach ( $res as $row ) {
128128 $wiki->_extensions[$row->fe_name] = MediaWikiFarmer_Extension::newFromRow( $row );
129129 }
130130
@@ -137,7 +137,7 @@
138138 $this->wgDefaultSkin = $farmer->defaultSkin;
139139
140140 // before we create the database, make sure this database doesn't really exist yet
141 - if( !$this->exists() && !$this->databaseExists() ){
 141+ if ( !$this->exists() && !$this->databaseExists() ) {
142142 $this->save();
143143 $this->createDatabase();
144144 $farmer->updateFarmList();
@@ -155,7 +155,7 @@
156156 public function exists() {
157157 $farmer = MediaWikiFarmer::getInstance();
158158
159 - if( $farmer->useDatabase() ) {
 159+ if ( $farmer->useDatabase() ) {
160160 return (bool)$farmer->getDB( DB_SLAVE )->selectField( 'farmer_wiki', 1, array( 'fw_name' => $this->_name ), __METHOD__ );
161161 } else {
162162 return file_exists( self::_getWikiConfigFile( $this->_name ) );
@@ -165,7 +165,7 @@
166166 public function save() {
167167 $farmer = MediaWikiFarmer::getInstance();
168168
169 - if( $farmer->useDatabase() ) {
 169+ if ( $farmer->useDatabase() ) {
170170 $dbw = $farmer->getDB( DB_MASTER );
171171 $new = array(
172172 'fw_name' => $this->_name,
@@ -177,7 +177,7 @@
178178 );
179179
180180 $curId = $dbw->selectField( 'farmer_wiki', 'fw_id', array( 'fw_name' => $this->_name ), __METHOD__ );
181 - if( $curId == null ) {
 181+ if ( $curId == null ) {
182182 $dbw->insert( 'farmer_wiki', $new, __METHOD__ );
183183 $curId = $dbw->insertId();
184184 } else {
@@ -185,7 +185,7 @@
186186 }
187187
188188 $insert = array();
189 - foreach( $this->_extensions as $ext ) {
 189+ foreach ( $this->_extensions as $ext ) {
190190 $insert[] = array( 'fwe_wiki' => $curId, 'fwe_extension' => $ext->id );
191191 }
192192 $dbw->delete( 'farmer_wiki_extension', array( 'fwe_wiki' => $curId ), __METHOD__ );
@@ -199,12 +199,12 @@
200200 }
201201
202202 public function delete() {
203 - if( !$this->exists() )
 203+ if ( !$this->exists() )
204204 return;
205205
206206 $farmer = MediaWikiFarmer::getInstance();
207 -
208 - if( $farmer->useDatabase() ) {
 207+
 208+ if ( $farmer->useDatabase() ) {
209209 $dbw = $farmer->getDB( DB_MASTER );
210210 $dbw->deleteJoin( 'farmer_wiki_extension', 'farmer_wiki', 'fwe_wiki', 'fw_id', array( 'fw_name' => $this->_name ), __METHOD__ );
211211 $dbw->delete( 'farmer_wiki', array( 'fw_name' => $this->_name ), __METHOD__ );
@@ -217,8 +217,8 @@
218218 try {
219219 $db = $this->getDatabase();
220220 return $db->tableExists( 'page' );
221 - } catch( Exception $e ){
222 - return false;
 221+ } catch ( Exception $e ) {
 222+ return false;
223223 }
224224 }
225225
@@ -227,15 +227,15 @@
228228 * use this wiki
229229 */
230230 public function initialize() {
231 - //loop over defined variables and set them in the global scope
232 - foreach( $this->_variables as $k => $v ) {
 231+ // loop over defined variables and set them in the global scope
 232+ foreach ( $this->_variables as $k => $v ) {
233233 $GLOBALS[$k] = $v;
234234 }
235235
236 - //we need to bring some global variables into scope so we can load extensions properly
 236+ // we need to bring some global variables into scope so we can load extensions properly
237237 extract( $GLOBALS, EXTR_REFS );
238238
239 - //register all the extensions
 239+ // register all the extensions
240240 foreach ( $this->_extensions as $extension ) {
241241 foreach ( $extension->includeFiles as $file ) {
242242 require_once $file;
@@ -243,7 +243,7 @@
244244 }
245245
246246 $farmer = MediaWikiFarmer::getInstance();
247 - if( $farmer->useWgConf() ){
 247+ if ( $farmer->useWgConf() ) {
248248 // Nothing for now
249249 } else {
250250 $wgSitename = $this->_title;
@@ -264,21 +264,21 @@
265265 list( $wgDBname, $wgDBprefix ) = $farmer->splitWikiDB( $this->name );
266266 }
267267
268 - //we allocate permissions to the necessary groups
 268+ // we allocate permissions to the necessary groups
269269
270 - foreach ( $this->_permissions['*'] as $k=>$v ) {
 270+ foreach ( $this->_permissions['*'] as $k => $v ) {
271271 $wgGroupPermissions['*'][$k] = $v;
272272 }
273273
274 - foreach ( $this->_permissions['user'] as $k=>$v ) {
 274+ foreach ( $this->_permissions['user'] as $k => $v ) {
275275 $wgGroupPermissions['user'][$k] = $v;
276276 }
277277
278278 $wgGroupPermissions['sysop']['read'] = true;
279279
280 - //assign permissions to administrators of this wiki
281 - if( $farmer->sharingGroups() ){
282 - $group = '[farmer]['.$this->_name.'][admin]';
 280+ // assign permissions to administrators of this wiki
 281+ if ( $farmer->sharingGroups() ) {
 282+ $group = '[farmer][' . $this->_name . '][admin]';
283283
284284 $grantToWikiAdmins = array( 'read', 'edit' );
285285
@@ -287,8 +287,8 @@
288288 }
289289 }
290290
291 - if( $callback = $farmer->initCallback() ) {
292 - if( is_callable( $callback ) ) {
 291+ if ( $callback = $farmer->initCallback() ) {
 292+ if ( is_callable( $callback ) ) {
293293 call_user_func( $callback, $this );
294294 } else {
295295 trigger_error( '$wgFarmerSettings[\'initCallback\'] is not callable', E_USER_WARNING );
@@ -314,28 +314,28 @@
315315 }
316316
317317 public function getUrl( $article = null ) {
318 - if( MediaWikiFarmer::getInstance()->useWgConf() ){
 318+ if ( MediaWikiFarmer::getInstance()->useWgConf() ) {
319319 global $wgConf;
320320 $server = $wgConf->get( 'wgServer', $this->name );
321321 $articlePath = $wgConf->get( 'wgArticlePath', $this->name );
322 - if( !$articlePath ){
 322+ if ( !$articlePath ) {
323323 $usePathInfo = $wgConf->get( 'wgUsePathInfo', $this->name );
324 - if( is_null( $usePathInfo ) ){
 324+ if ( is_null( $usePathInfo ) ) {
325325 global $wgUsePathInfo;
326326 $usePathInfo = $wgUsePathInfo;
327327 }
328328 $articlePath = $wgConf->get( 'wgScriptPath', $this->name ) . ( $usePathInfo ? '/$1' : '?title=$1' );
329329 }
330 - $url = $server . $articlePath;
 330+ $url = $server . $articlePath;
331331 } else {
332332 $url = wfMsgForContent( 'farmerinterwikiurl', $this->name, '$1' );
333333 }
334 - if( !is_null( $article ) )
 334+ if ( !is_null( $article ) )
335335 $url = str_replace( '$1', $article, $url );
336336 return $url;
337337 }
338338
339 - public function isDefaultWiki(){
 339+ public function isDefaultWiki() {
340340 return $this->_name == MediaWikiFarmer::getInstance()->getDefaultWiki();
341341 }
342342
@@ -344,7 +344,7 @@
345345 # ----------------
346346
347347 public function setPermission( $group, $permission, $value ) {
348 - if( !array_key_exists( $group, $this->_permissions ) ) {
 348+ if ( !array_key_exists( $group, $this->_permissions ) ) {
349349 $this->_permissions[$group] = array();
350350 }
351351
@@ -371,8 +371,8 @@
372372 return $this->getPermission( 'user', $permission );
373373 }
374374
375 - public function userIsAdmin( $user ){
376 - $adminGroup = '[farmer]['.$this->_name.'][admin]';
 375+ public function userIsAdmin( $user ) {
 376+ $adminGroup = '[farmer][' . $this->_name . '][admin]';
377377
378378 return in_array( $adminGroup, $user->getGroups() );
379379 }
@@ -388,7 +388,7 @@
389389 public function hasExtension( MediaWikiFarmer_Extension $e ) {
390390 return array_key_exists( $e->name, $this->_extensions );
391391 }
392 -
 392+
393393 # --------------
394394 # Database stuff
395395 # --------------
@@ -401,8 +401,8 @@
402402 public function getDatabase( $selectDB = true ) {
403403 global $wgDBserver, $wgDBtype;
404404 $farmer = MediaWikiFarmer::getInstance();
405 - if( $selectDB ){
406 - if( isset( $this->_db ) && is_object( $this->_db ) )
 405+ if ( $selectDB ) {
 406+ if ( isset( $this->_db ) && is_object( $this->_db ) )
407407 return $this->_db;
408408 list( $db, $prefix ) = $farmer->splitWikiDB( $this->name );
409409 } else {
@@ -413,7 +413,7 @@
414414 $password = $farmer->dbAdminPassword;
415415 $class = 'Database' . ucfirst( $wgDBtype );
416416 $object = new $class( $wgDBserver, $user, $password, $db, false, 0, $prefix );
417 - if( $selectDB )
 417+ if ( $selectDB )
418418 $this->_db = $object;
419419 return $object;
420420 }
@@ -444,11 +444,11 @@
445445 $db = false;
446446 try {
447447 $db = $this->getDatabase();
448 - } catch( DBConnectionError $e ) {
 448+ } catch ( DBConnectionError $e ) {
449449 $db = false;
450450 }
451451
452 - if( !$db ){
 452+ if ( !$db ) {
453453 list( $dbname, $prefix ) = $farmer->splitWikiDB( $this->name );
454454 $db = $this->getDatabase( false );
455455 $db->query( "CREATE DATABASE `{$dbname}`", __METHOD__ );
@@ -477,7 +477,7 @@
478478 $revid = $revision->insertOn( $db );
479479 $article->updateRevisionOn( $db, $revision );
480480
481 - //site_stats table entry
 481+ // site_stats table entry
482482 $db->insert( 'site_stats', array(
483483 'ss_row_id' => 1,
484484 'ss_total_views' => 0,
@@ -507,13 +507,13 @@
508508
509509 protected function _populateUserGroups() {
510510 if ( $this->creator ) {
511 - if( MediaWikiFarmer::getInstance()->sharingGroups() ){
 511+ if ( MediaWikiFarmer::getInstance()->sharingGroups() ) {
512512 $user = User::newFromname( $this->creator );
513 - $group = '[farmer]['.$this->name.'][admin]';
 513+ $group = '[farmer][' . $this->name . '][admin]';
514514 $user->addGroup( $group );
515515 } else {
516516 $userId = User::idFromName( $this->creator );
517 - if( $userId ) {
 517+ if ( $userId ) {
518518 $insert = array(
519519 array( 'ug_user' => $userId, 'ug_group' => 'sysop' ),
520520 array( 'ug_user' => $userId, 'ug_group' => 'bureaucrat' ),
@@ -539,19 +539,19 @@
540540
541541 $prefix = $db->getProperty( 'mTablePrefix' );
542542
543 - while( $row = $result->fetchRow() ) {
544 - if( $prefix == '' || strpos( $row[0], $prefix ) === 0 ) {
545 - $query = 'DROP TABLE `'. $row[0] . '`';
 543+ while ( $row = $result->fetchRow() ) {
 544+ if ( $prefix == '' || strpos( $row[0], $prefix ) === 0 ) {
 545+ $query = 'DROP TABLE `' . $row[0] . '`';
546546 $db->query( $query, __METHOD__ );
547547 }
548548 }
549549 }
550550
551551 protected function _deleteWikiGroups() {
552 - if( MediaWikiFarmer::getInstance()->sharingGroups() ){
 552+ if ( MediaWikiFarmer::getInstance()->sharingGroups() ) {
553553 $db = $this->getDatabase();
554554 $query = 'DELETE FROM ' . $db->tableName( 'user_groups' ) . ' WHERE ug_group LIKE ';
555 - $query .= '\'[farmer]['.$this->_name.']%\'';
 555+ $query .= '\'[farmer][' . $this->_name . ']%\'';
556556 $db->query( $query, __METHOD__ );
557557 }
558558 }
Index: trunk/extensions/Farmer/farmer.sql
@@ -30,4 +30,4 @@
3131 CREATE INDEX farmer_wiki_extension_wiki ON farmer_wiki_extension ( fwe_wiki );
3232 CREATE INDEX farmer_wiki_extension_extension ON farmer_wiki_extension ( fwe_extension );
3333 ALTER TABLE farmer_wiki_extension
34 - ADD CONSTRAINT farmer_wiki_extension_wiki_extension PRIMARY KEY ( fwe_wiki, fwe_extension );
\ No newline at end of file
 34+ ADD CONSTRAINT farmer_wiki_extension_wiki_extension PRIMARY KEY ( fwe_wiki, fwe_extension );

Status & tagging log