r47780 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r47779‎ | r47780 | r47781 >
Date:04:31, 25 February 2009
Author:werdna
Status:ok
Tags:
Comment:
Fix Abuse Filter after-the-fact var generation -- was using request IP address in place of IPs for anonymous changes
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -1003,7 +1003,15 @@
10041004 $vars = array();
10051005 $title = Title::makeTitle( $row->rc_namespace, $row->rc_title );
10061006
1007 - $vars = array_merge( $vars, self::generateUserVars( User::newFromId( $row->rc_user ) ) );
 1007+ if ($row->rc_user)
 1008+ $user = User::newFromId( $row->rc_user );
 1009+ else {
 1010+ $user = new User;
 1011+ $user->setName( $row->rc_user_text );
 1012+ }
 1013+
 1014+ $vars = array_merge( $vars, self::generateUserVars( $user ) );
 1015+
10081016 $vars = array_merge( $vars, self::generateTitleVars( $title, 'ARTICLE' ) );
10091017 $vars['ACTION'] = 'edit';
10101018 $vars['SUMMARY'] = $row->rc_comment;
@@ -1027,7 +1035,13 @@
10281036 public static function getMoveVarsFromRCRow( $row ) {
10291037 $vars = array();
10301038
1031 - $user = User::newFromId( $row->rc_user );
 1039+ if ($row->rc_user)
 1040+ $user = User::newFromId( $row->rc_user );
 1041+ else {
 1042+ $user = new User;
 1043+ $user->setName( $row->rc_user_text );
 1044+ }
 1045+
10321046 $oldTitle = Title::makeTitle( $row->rc_namespace, $row->rc_title );
10331047 $newTitle = Title::newFromText( trim($row->rc_params) );
10341048

Status & tagging log