Index: trunk/extensions/CheckUser/CheckUser.i18n.php |
— | — | @@ -87,6 +87,7 @@ |
88 | 88 | 'checkuser-log-useredits' => '$1 got edits for $2', |
89 | 89 | |
90 | 90 | 'checkuser-autocreate-action' => 'was automatically created', |
| 91 | + 'checkuser-create-action' => 'was created', |
91 | 92 | 'checkuser-email-action' => 'sent an email to user "$1"', |
92 | 93 | 'checkuser-reset-action' => 'reset password for user "$1"', |
93 | 94 | |
Index: trunk/extensions/CheckUser/CheckUser.php |
— | — | @@ -65,6 +65,7 @@ |
66 | 66 | $wgHooks['EmailUser'][] = 'efUpdateCUEmailData'; |
67 | 67 | $wgHooks['User::mailPasswordInternal'][] = 'efUpdateCUPasswordResetData'; |
68 | 68 | $wgHooks['AuthPluginAutoCreate'][] = 'efUpdateAutoCreateData'; |
| 69 | +$wgHooks['AddNewAccount'][] = 'efAddNewAccount'; |
69 | 70 | |
70 | 71 | $wgHooks['ParserTestTables'][] = 'efCheckUserParserTestTables'; |
71 | 72 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'efCheckUserSchemaUpdates'; |
— | — | @@ -236,8 +237,21 @@ |
237 | 238 | /** |
238 | 239 | * Hook function to store autocreation data from the auth plugin |
239 | 240 | * Saves user data into the cu_changes table |
| 241 | + * |
| 242 | + * @param $user User |
| 243 | + * |
| 244 | + * @return true |
240 | 245 | */ |
241 | 246 | 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 ) { |
242 | 256 | // Get IP |
243 | 257 | $ip = wfGetIP(); |
244 | 258 | // Get XFF header |
— | — | @@ -257,7 +271,7 @@ |
258 | 272 | 'cuc_minor' => 0, |
259 | 273 | 'cuc_user' => $user->getId(), |
260 | 274 | 'cuc_user_text' => $user->getName(), |
261 | | - 'cuc_actiontext' => wfMsgForContent( 'checkuser-autocreate-action' ), |
| 275 | + 'cuc_actiontext' => wfMsgForContent( $actiontext ), |
262 | 276 | 'cuc_comment' => '', |
263 | 277 | 'cuc_this_oldid' => 0, |
264 | 278 | 'cuc_last_oldid' => 0, |
— | — | @@ -275,6 +289,18 @@ |
276 | 290 | } |
277 | 291 | |
278 | 292 | /** |
| 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 | +/** |
279 | 305 | * Locates the client IP within a given XFF string |
280 | 306 | * @param string $xff |
281 | 307 | * @param string $address, the ip that sent this header (optional) |