r111814 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111813‎ | r111814 | r111815 >
Date:02:48, 18 February 2012
Author:reedy
Status:ok
Tags:
Comment:
Actually variablise the table/column we're reading user information from - normally, the user table with user_name, but in centralauth, its globaluser and gu_name

Yay, no LSB ;)

Ping fixme on r106809

I'll check this over post sleep and push when I'm around to babysit it
Modified paths:
  • /trunk/extensions/AntiSpoof/SpoofUser.php (modified) (history)
  • /trunk/extensions/CentralAuth/AntiSpoof/CentralAuthSpoofUser.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/AntiSpoof/CentralAuthSpoofUser.php
@@ -14,4 +14,18 @@
1515 protected static function getDBMaster() {
1616 return CentralAuthUser::getCentralDB();
1717 }
 18+
 19+ /**
 20+ * @return string
 21+ */
 22+ protected function getTableName() {
 23+ return 'globaluser';
 24+ }
 25+
 26+ /**
 27+ * @return string
 28+ */
 29+ protected function getUserColumn() {
 30+ return 'gu_name';
 31+ }
1832 }
Index: trunk/extensions/AntiSpoof/SpoofUser.php
@@ -43,6 +43,20 @@
4444 }
4545
4646 /**
 47+ * @return string
 48+ */
 49+ protected function getTableName() {
 50+ return 'user';
 51+ }
 52+
 53+ /**
 54+ * @return string
 55+ */
 56+ protected function getUserColumn() {
 57+ return 'user_name';
 58+ }
 59+
 60+ /**
4761 * Does the username pass Unicode legality and script-mixing checks?
4862 *
4963 * @return array empty if no conflict, or array containing conflicting usernames
@@ -53,11 +67,11 @@
5468 // Join against the user table to ensure that we skip stray
5569 // entries left after an account is renamed or otherwise munged.
5670 $spoofedUsers = $dbr->select(
57 - array( 'spoofuser', 'user' ),
58 - array( 'user_name' ),
 71+ array( 'spoofuser', $this->getTableName() ),
 72+ array( 'su_name' ), // Same thing due to the join. Saves extra variableness
5973 array(
6074 'su_normalized' => $this->mNormalized,
61 - 'su_name=user_name',
 75+ 'su_name = ' . $this->getUserColumn(),
6276 ),
6377 __METHOD__,
6478 array(
@@ -66,7 +80,7 @@
6781
6882 $spoofs = array();
6983 foreach ( $spoofedUsers as $row ) {
70 - array_push( $spoofs, $row->user_name );
 84+ array_push( $spoofs, $row->su_name );
7185 }
7286 return $spoofs;
7387 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r111830MFT r111814reedy15:11, 18 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106809Followup r106808...reedy16:29, 20 December 2011

Status & tagging log