r10242 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r10241‎ | r10242 | r10243 >
Date:19:15, 22 July 2005
Author:avar
Status:old
Tags:
Comment:
* (bug 2772) Now logging to my own log
Modified paths:
  • /trunk/extensions/Renameuser/SpecialRenameuser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Renameuser/SpecialRenameuser.php
@@ -24,7 +24,7 @@
2525 define( 'RENAMEUSER_CONTRIBLIMIT', 5000 );
2626
2727 function wfSpecialRenameuser() {
28 - global $IP, $wgMessageCache;
 28+ global $IP, $wgMessageCache, $wgHooks;
2929
3030 $wgMessageCache->addMessages(
3131 array(
@@ -37,10 +37,17 @@
3838 'renameusererrortoomany' => 'The user "<nowiki>$1</nowiki>" has $2 contributions, renaming a user with more ' .
3939 'than $3 contributions could adversely affect site performance',
4040 'renameusersuccess' => 'The user "<nowiki>$1</nowiki>" has been renamed to "<nowiki>$2</nowiki>"',
 41+
 42+ 'renameuserlogpage' => 'User rename log',
 43+ 'renameuserlogpagetext' => 'This is a log of changes to user names',
4144 'renameuserlog' => 'Renamed the user "[[User:$1|$1]]" to "[[User:$2|$2]]"',
4245 )
4346 );
4447
 48+ $wgHooks['LogPageValidTypes'][] = 'wfSpecialRenameuserAddLogType';
 49+ $wgHooks['LogPageLogName'][] = 'wfSpecialRenameuserAddLogName';
 50+ $wgHooks['LogPageLogHeader'][] = 'wfSpecialRenameuserAddLogHeader';
 51+
4552 require_once( "$IP/includes/SpecialPage.php" );
4653 class Renameuser extends SpecialPage {
4754 function Renameuser() {
@@ -139,11 +146,11 @@
140147 return;
141148 }
142149
143 - $rename = new RenameuserSQL($oldusername, $newusername, $uid );
 150+ $rename = new RenameuserSQL( $oldusername, $newusername, $uid );
144151 $rename->rename();
145152
146 - $log = new LogPage( '' );
147 - $log->addEntry( '', $wgTitle, wfMsg( 'renameuserlog', $oldusername, $newusername ) );
 153+ $log = new LogPage( 'renameuser' );
 154+ $log->addEntry( 'renameuser', $wgTitle, wfMsg( 'renameuserlog', $oldusername, $newusername ) );
148155
149156 $wgOut->addWikiText( wfMsg( 'renameusersuccess', $oldusername, $newusername ) );
150157 }
@@ -239,3 +246,16 @@
240247 }
241248 SpecialPage::addPage( new Renameuser );
242249 }
 250+
 251+function wfSpecialRenameuserAddLogType( &$types ) {
 252+ if ( !in_array( 'renameuser', $types ) )
 253+ $types[] = 'renameuser';
 254+}
 255+
 256+function wfSpecialRenameuserAddLogName( &$names ) {
 257+ $names['renameuser'] = 'renameuserlogpage';
 258+}
 259+
 260+function wfSpecialRenameuserAddLogHeader( &$headers ) {
 261+ $headers['renameuser'] = 'renameuserlogpagetext';
 262+}

Status & tagging log