r88258 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88257‎ | r88258 | r88259 >
Date:19:16, 16 May 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 19963) Make CheckUser log IPs for all account creations

Not sure if the AuthPluginAutoCreate hook is now superfluous, or it's on a different path, and won't be called by the normal user creation...
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser.i18n.php (modified) (history)
  • /trunk/extensions/CheckUser/CheckUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser.i18n.php
@@ -87,6 +87,7 @@
8888 'checkuser-log-useredits' => '$1 got edits for $2',
8989
9090 'checkuser-autocreate-action' => 'was automatically created',
 91+ 'checkuser-create-action' => 'was created',
9192 'checkuser-email-action' => 'sent an email to user "$1"',
9293 'checkuser-reset-action' => 'reset password for user "$1"',
9394
Index: trunk/extensions/CheckUser/CheckUser.php
@@ -65,6 +65,7 @@
6666 $wgHooks['EmailUser'][] = 'efUpdateCUEmailData';
6767 $wgHooks['User::mailPasswordInternal'][] = 'efUpdateCUPasswordResetData';
6868 $wgHooks['AuthPluginAutoCreate'][] = 'efUpdateAutoCreateData';
 69+$wgHooks['AddNewAccount'][] = 'efAddNewAccount';
6970
7071 $wgHooks['ParserTestTables'][] = 'efCheckUserParserTestTables';
7172 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCheckUserSchemaUpdates';
@@ -236,8 +237,21 @@
237238 /**
238239 * Hook function to store autocreation data from the auth plugin
239240 * Saves user data into the cu_changes table
 241+ *
 242+ * @param $user User
 243+ *
 244+ * @return true
240245 */
241246 function efUpdateAutoCreateData( $user ) {
 247+ return efLogUserAccountCreation( $user, 'checkuser-autocreate-action' );
 248+}
 249+
 250+/**
 251+ * @param $user User
 252+ * @param $actiontext string
 253+ * @return bool
 254+ */
 255+function efLogUserAccountCreation( $user, $actiontext ) {
242256 // Get IP
243257 $ip = wfGetIP();
244258 // Get XFF header
@@ -257,7 +271,7 @@
258272 'cuc_minor' => 0,
259273 'cuc_user' => $user->getId(),
260274 'cuc_user_text' => $user->getName(),
261 - 'cuc_actiontext' => wfMsgForContent( 'checkuser-autocreate-action' ),
 275+ 'cuc_actiontext' => wfMsgForContent( $actiontext ),
262276 'cuc_comment' => '',
263277 'cuc_this_oldid' => 0,
264278 'cuc_last_oldid' => 0,
@@ -275,6 +289,18 @@
276290 }
277291
278292 /**
 293+ * Hook function to store registration data
 294+ * Saves user data into the cu_changes table
 295+ *
 296+ * @param $user User
 297+ * @param $byEmail bool
 298+ * @return bool
 299+ */
 300+function efAddNewAccount( $user, $byEmail ) {
 301+ return efLogUserAccountCreation( $user, 'checkuser-create-action' );
 302+}
 303+
 304+/**
279305 * Locates the client IP within a given XFF string
280306 * @param string $xff
281307 * @param string $address, the ip that sent this header (optional)

Status & tagging log