r51741 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51740‎ | r51741 | r51742 >
Date:12:49, 11 June 2009
Author:werdna
Status:deferred
Tags:
Comment:
Implement basic honeypot hit logging
Modified paths:
  • /trunk/extensions/HoneypotIntegration/HoneypotIntegration.class.php (modified) (history)
  • /trunk/extensions/HoneypotIntegration/HoneypotIntegration.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HoneypotIntegration/HoneypotIntegration.php
@@ -28,8 +28,9 @@
2929 #$wgHooks['AbuseFilter-filterAction'][] = 'HoneypotIntegration::onAbuseFilterFilterAction';
3030 #$wgHooks['AbuseFilter-builder'][] = 'HoneypotIntegration::onAbuseFilterBuilder';
3131 $wgHooks['EditPage::showEditForm:fields'][] = 'HoneypotIntegration::onShowEditForm';
32 -$wgHooks['GetUserPermissionsErrorsExpensive'][] =
33 - 'HoneypotIntegration::onGetUserPermissionsErrorsExpensive';
 32+// $wgHooks['GetUserPermissionsErrorsExpensive'][] =
 33+// 'HoneypotIntegration::onGetUserPermissionsErrorsExpensive';
 34+$wgHooks['RecentChange_save'][] = 'HoneypotIntegration::onRecentChangeSave';
3435
3536 $wgHoneypotURLSource = '';
3637
Index: trunk/extensions/HoneypotIntegration/HoneypotIntegration.class.php
@@ -209,4 +209,19 @@
210210 }
211211 return true;
212212 }
 213+
 214+ public static function onRecentChangeSave( $rc ) {
 215+ $ip = wfGetIP();
 216+ if ( self::isIPListed( $ip ) ) {
 217+ $user = $rc->getAttribute( 'rc_user_text' );
 218+ $revid = $rc->getAttribute( 'rc_this_oldid' );
 219+ $logid = $rc->getAttribute( 'rc_logid' );
 220+ $rcid = $rc->getAttribute( 'rc_id' );
 221+
 222+ wfDebugLog( 'HoneypotHit', "$ip is listed in honeypot data. ".
 223+ "$user made RCID $rcid REVID $revid LOGID $logid." );
 224+ }
 225+
 226+ return true;
 227+ }
213228 }

Status & tagging log