Index: trunk/extensions/CheckUser/CheckUser.i18n.php |
— | — | @@ -70,6 +70,7 @@ |
71 | 71 | 'checkuser-log-ipusers-xff' => '$1 got users for XFF $2', |
72 | 72 | 'checkuser-log-useredits' => '$1 got edits for $2', |
73 | 73 | |
| 74 | + 'checkuser-autocreate-action' => 'was automatically created', |
74 | 75 | 'checkuser-email-action' => 'sent an email to user "$1"', |
75 | 76 | 'checkuser-reset-action' => 'reset password for user "$1"', |
76 | 77 | |
Index: trunk/extensions/CheckUser/CheckUser.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | # Recent changes data hook |
38 | 38 | global $wgHooks; |
39 | 39 | $wgHooks['RecentChange_save'][] = 'efUpdateCheckUserData'; |
| 40 | +$wgHooks['AuthPluginAutoCreate'][] = 'efUpdateAutoCreateData'; |
40 | 41 | $wgHooks['EmailUser'][] = 'efUpdateCUEmailData'; |
41 | 42 | $wgHooks['User::mailPasswordInternal'][] = 'efUpdateCUPasswordResetData'; |
42 | 43 | |
— | — | @@ -113,6 +114,48 @@ |
114 | 115 | } |
115 | 116 | |
116 | 117 | /** |
| 118 | + * Hook function to store autocreation data from the auth plugin |
| 119 | + * Saves user data into the cu_changes table |
| 120 | + */ |
| 121 | +function efUpdateAutoCreateData( $user ) { |
| 122 | + wfLoadExtensionMessages( 'CheckUser' ); |
| 123 | + // Get IP |
| 124 | + $ip = wfGetIP(); |
| 125 | + // Get XFF header |
| 126 | + $xff = wfGetForwardedFor(); |
| 127 | + list($xff_ip,$trusted) = efGetClientIPfromXFF( $xff ); |
| 128 | + // Our squid XFFs can flood this up sometimes |
| 129 | + $isSquidOnly = efXFFChainIsSquid( $xff ); |
| 130 | + // Get agent |
| 131 | + $agent = wfGetAgent(); |
| 132 | + $dbw = wfGetDB( DB_MASTER ); |
| 133 | + $cuc_id = $dbw->nextSequenceValue( 'cu_changes_cu_id_seq' ); |
| 134 | + $rcRow = array( |
| 135 | + 'cuc_id' => $cuc_id, |
| 136 | + 'cuc_page_id' => 0, |
| 137 | + 'cuc_namespace' => NS_USER, |
| 138 | + 'cuc_title' => '', |
| 139 | + 'cuc_minor' => 0, |
| 140 | + 'cuc_user' => User::idFromName($user), |
| 141 | + 'cuc_user_text' => $user, |
| 142 | + 'cuc_actiontext' => wfMsgForContent('checkuser-autocreate-action'), |
| 143 | + 'cuc_comment' => '', |
| 144 | + 'cuc_this_oldid' => 0, |
| 145 | + 'cuc_last_oldid' => 0, |
| 146 | + 'cuc_type' => RC_LOG, |
| 147 | + 'cuc_timestamp' => $dbw->timestamp( wfTimestampNow() ), |
| 148 | + 'cuc_ip' => IP::sanitizeIP($ip), |
| 149 | + 'cuc_ip_hex' => $ip ? IP::toHex( $ip ) : null, |
| 150 | + 'cuc_xff' => !$isSquidOnly ? $xff : '', |
| 151 | + 'cuc_xff_hex' => ($xff_ip && !$isSquidOnly) ? IP::toHex( $xff_ip ) : null, |
| 152 | + 'cuc_agent' => $agent |
| 153 | + ); |
| 154 | + $dbw->insert( 'cu_changes', $rcRow, __METHOD__ ); |
| 155 | + |
| 156 | + return true; |
| 157 | +} |
| 158 | + |
| 159 | +/** |
117 | 160 | * Hook function to store password reset |
118 | 161 | * Saves user data into the cu_changes table |
119 | 162 | */ |