r34435 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34434‎ | r34435 | r34436 >
Date:14:30, 8 May 2008
Author:ialex
Status:old
Tags:
Comment:
* Remove uneeded extension function, simply define the new log when including the file
* Fixed XHTML errors
* (bug 13876) Special:Makebot states that bots don't have bot status
Modified paths:
  • /trunk/extensions/Makebot/Makebot.class.php (modified) (history)
  • /trunk/extensions/Makebot/Makebot.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Makebot/Makebot.php
@@ -15,7 +15,6 @@
1616 define( 'MW_MAKEBOT_GRANT', 1 );
1717 define( 'MW_MAKEBOT_REVOKE', 2 );
1818
19 - $wgExtensionFunctions[] = 'efMakeBot';
2019 $wgAvailableRights[] = 'makebot';
2120 $wgExtensionCredits['specialpage'][] = array(
2221 'name' => 'MakeBot',
@@ -23,8 +22,8 @@
2423 'url' => 'http://www.mediawiki.org/wiki/Extension:MakeBot',
2524 'description' => 'Special page allows local bureaucrats to grant and revoke bot permissions',
2625 'descriptionmsg' => 'makebot-desc',
27 - 'svn-date' => '$LastChangedDate$',
28 - 'svn-revision' => '$LastChangedRevision$',
 26+ 'svn-date' => '$LastChangedDate$',
 27+ 'svn-revision' => '$LastChangedRevision$',
2928 );
3029
3130 /**
@@ -32,6 +31,7 @@
3332 */
3433 $dir = dirname(__FILE__) . '/';
3534 $wgExtensionMessagesFiles['Makebot'] = $dir . 'Makebot.i18n.php';
 35+
3636 /**
3737 * Determines who can use the extension; as a default, bureaucrats are permitted
3838 */
@@ -50,16 +50,13 @@
5151 $wgSpecialPageGroups['Makebot'] = 'users';
5252
5353 /**
54 - * Populate the message cache and set up the auditing
 54+ * Set up the auditing
5555 */
56 - function efMakeBot() {
57 - global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions;
58 - $wgLogTypes[] = 'makebot';
59 - $wgLogNames['makebot'] = 'makebot-logpage';
60 - $wgLogHeaders['makebot'] = 'makebot-logpagetext';
61 - $wgLogActions['makebot/grant'] = 'makebot-logentrygrant';
62 - $wgLogActions['makebot/revoke'] = 'makebot-logentryrevoke';
63 - }
 56+ $wgLogTypes[] = 'makebot';
 57+ $wgLogNames['makebot'] = 'makebot-logpage';
 58+ $wgLogHeaders['makebot'] = 'makebot-logpagetext';
 59+ $wgLogActions['makebot/grant'] = 'makebot-logentrygrant';
 60+ $wgLogActions['makebot/revoke'] = 'makebot-logentryrevoke';
6461
6562 } else {
6663 echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" );
Index: trunk/extensions/Makebot/Makebot.class.php
@@ -38,7 +38,7 @@
3939 $wgOut->addHtml( $this->makeSearchForm() );
4040
4141 if( $this->target != '' ) {
42 - $wgOut->addHtml( wfElement( 'p', NULL, NULL ) );
 42+ //$wgOut->addHtml( wfElement( 'p', NULL, NULL ) );
4343 $user = User::newFromName( $this->target );
4444 if( is_object( $user ) && !is_null( $user ) ) {
4545 global $wgVersion;
@@ -53,7 +53,7 @@
5454 $canBecomeBot = $this->canBecomeBot( $user );
5555 if( $wgRequest->getCheck( 'dosearch' ) || !$wgRequest->wasPosted() || !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ), 'makebot' ) ) {
5656 # Exists, check botness
57 - if( in_array( 'bot', $user->mGroups ) ) {
 57+ if( in_array( 'bot', $user->getGroups() ) ) {
5858 # Has a bot flag
5959 $wgOut->addWikiText( wfMsg( 'makebot-isbot', $user->getName() ) );
6060 $wgOut->addHtml( $this->makeGrantForm( MW_MAKEBOT_REVOKE ) );
@@ -135,8 +135,10 @@
136136 }
137137 $form .= wfCloseElement( 'td' ) . wfCloseElement( 'tr' );
138138 # Comment field
 139+ $form .= wfOpenElement( 'tr' );
139140 $form .= wfOpenElement( 'td', array( 'align' => 'right' ) );
140141 $form .= wfElement( 'label', array( 'for' => 'comment' ), wfMsg( 'makebot-comment' ) );
 142+ $form .= wfCloseElement( 'td' );
141143 $form .= wfOpenElement( 'td' );
142144 $form .= wfElement( 'input', array( 'type' => 'text', 'name' => 'comment', 'id' => 'comment', 'size' => 45, 'maxlength' => 255 ) );
143145 $form .= wfCloseElement( 'td' ) . wfCloseElement( 'tr' );
@@ -182,9 +184,8 @@
183185 */
184186 function canBecomeBot( &$user ) {
185187 global $wgMakeBotPrivileged;
186 - $user->loadFromDatabase();
187188 return $wgMakeBotPrivileged ||
188 - ( !in_array( 'sysop', $user->mGroups ) &&
189 - !in_array( 'bureaucrat', $user->mGroups ) );
 189+ ( !in_array( 'sysop', $user->getGroups() ) &&
 190+ !in_array( 'bureaucrat', $user->getGroups() ) );
190191 }
191192 }

Status & tagging log