http://www.mediawiki.org/wiki/Special:Code/MediaWiki/88258

Revision: 88258
Author:   reedy
Date:     2011-05-16 19:16:01 +0000 (Mon, 16 May 2011)
Log Message:
-----------
* (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
    trunk/extensions/CheckUser/CheckUser.php

Modified: trunk/extensions/CheckUser/CheckUser.i18n.php
===================================================================
--- trunk/extensions/CheckUser/CheckUser.i18n.php       2011-05-16 19:05:35 UTC 
(rev 88257)
+++ trunk/extensions/CheckUser/CheckUser.i18n.php       2011-05-16 19:16:01 UTC 
(rev 88258)
@@ -87,6 +87,7 @@
        'checkuser-log-useredits'    => '$1 got edits for $2',
 
        'checkuser-autocreate-action' => 'was automatically created',
+       'checkuser-create-action' => 'was created',
        'checkuser-email-action'     => 'sent an email to user "$1"',
        'checkuser-reset-action'     => 'reset password for user "$1"',
 

Modified: trunk/extensions/CheckUser/CheckUser.php
===================================================================
--- trunk/extensions/CheckUser/CheckUser.php    2011-05-16 19:05:35 UTC (rev 
88257)
+++ trunk/extensions/CheckUser/CheckUser.php    2011-05-16 19:16:01 UTC (rev 
88258)
@@ -65,6 +65,7 @@
 $wgHooks['EmailUser'][] = 'efUpdateCUEmailData';
 $wgHooks['User::mailPasswordInternal'][] = 'efUpdateCUPasswordResetData';
 $wgHooks['AuthPluginAutoCreate'][] = 'efUpdateAutoCreateData';
+$wgHooks['AddNewAccount'][] = 'efAddNewAccount';
 
 $wgHooks['ParserTestTables'][] = 'efCheckUserParserTestTables';
 $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCheckUserSchemaUpdates';
@@ -236,8 +237,21 @@
 /**
  * Hook function to store autocreation data from the auth plugin
  * Saves user data into the cu_changes table
+ *
+ * @param $user User
+ *
+ * @return true
  */
 function efUpdateAutoCreateData( $user ) {
+       return efLogUserAccountCreation( $user, 'checkuser-autocreate-action' );
+}
+
+/**
+ * @param $user User
+ * @param $actiontext string
+ * @return bool
+ */
+function efLogUserAccountCreation( $user, $actiontext ) {
        // Get IP
        $ip = wfGetIP();
        // Get XFF header
@@ -257,7 +271,7 @@
                'cuc_minor'      => 0,
                'cuc_user'       => $user->getId(),
                'cuc_user_text'  => $user->getName(),
-               'cuc_actiontext' => wfMsgForContent( 
'checkuser-autocreate-action' ),
+               'cuc_actiontext' => wfMsgForContent( $actiontext ),
                'cuc_comment'    => '',
                'cuc_this_oldid' => 0,
                'cuc_last_oldid' => 0,
@@ -275,6 +289,18 @@
 }
 
 /**
+ * Hook function to store registration data
+ * Saves user data into the cu_changes table
+ *
+ * @param $user User
+ * @param $byEmail bool
+ * @return bool
+ */
+function efAddNewAccount( $user, $byEmail ) {
+       return efLogUserAccountCreation( $user, 'checkuser-create-action' );
+}
+
+/**
  * Locates the client IP within a given XFF string
  * @param string $xff
  * @param string $address, the ip that sent this header (optional)


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to