r106809 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106808‎ | r106809 | r106810 >
Date:16:29, 20 December 2011
Author:reedy
Status:resolved (Comments)
Tags:scaptrap 
Comment:
Followup r106808

*(bug 28747) AntiSpoof should also check global accounts from CentralAuth

TODO: Need to do something with batchAntiSpoof (rewrite to use Maintenance classes?) and create a like script for CA

TODO: Copy schema tables to CA for antispoof to be created on the same DB?
Modified paths:
  • /trunk/extensions/CentralAuth/AntiSpoof (added) (history)
  • /trunk/extensions/CentralAuth/AntiSpoof/CentralAuthAntiSpoofHooks.php (added) (history)
  • /trunk/extensions/CentralAuth/AntiSpoof/CentralAuthSpoofUser.php (added) (history)
  • /trunk/extensions/CentralAuth/CentralAuth.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralAuth/CentralAuth.php
@@ -263,6 +263,17 @@
264264 'styles' => 'ext.centralauth.css',
265265 ) + $commonModuleInfo;
266266
 267+// If AntiSpoof is installed, we can do some AntiSpoof stuff for CA
 268+if ( class_exists( 'AntiSpoof' ) ) {
 269+ $wgAutoloadClasses['CentralAuthSpoofUser'] = "$caBase/AntiSpoof/CentralAuthSpoofUser.php";
 270+ $wgAutoloadClasses['CentralAuthAntiSpoofHooks'] = "$caBase/AntiSpoof/CentralAuthAntiSpoofHooks.php";
 271+
 272+ $wgHooks['AbortNewAccount'][] = 'CentralAuthAntiSpoofHooks::asAbortNewAccountHook';
 273+ $wgHooks['UserCreateForm'][] = 'CentralAuthAntiSpoofHooks::asUserCreateFormHook';
 274+ $wgHooks['AddNewAccount'][] = 'CentralAuthAntiSpoofHooks::asAddNewAccountHook';
 275+ $wgHooks['RenameUserComplete'][] = 'CentralAuthAntiSpoofHooks::asAddRenameUserHook';
 276+}
 277+
267278 /**
268279 * @param $type
269280 * @param $action
Index: trunk/extensions/CentralAuth/AntiSpoof/CentralAuthSpoofUser.php
@@ -0,0 +1,17 @@
 2+<?php
 3+
 4+class CentralAuthSpoofUser extends SpoofUser {
 5+ /**
 6+ * @return DatabaseBase
 7+ */
 8+ protected static function getDBSlave() {
 9+ return CentralAuthUser::getCentralSlaveDB();
 10+ }
 11+
 12+ /**
 13+ * @return DatabaseBase
 14+ */
 15+ protected static function getDBMaster() {
 16+ return CentralAuthUser::getCentralDB();
 17+ }
 18+}
Property changes on: trunk/extensions/CentralAuth/AntiSpoof/CentralAuthSpoofUser.php
___________________________________________________________________
Added: svn:eol-style
119 + native
Index: trunk/extensions/CentralAuth/AntiSpoof/CentralAuthAntiSpoofHooks.php
@@ -0,0 +1,11 @@
 2+<?php
 3+
 4+class CentralAuthAntiSpoofHooks extends AntiSpoofHooks {
 5+ /**
 6+ * @param $name string Username
 7+ * @return CentralAuthAntiSpoofHooks
 8+ */
 9+ protected static function makeSpoofUser( $name ) {
 10+ return new CentralAuthSpoofUser( $name );
 11+ }
 12+}
Property changes on: trunk/extensions/CentralAuth/AntiSpoof/CentralAuthAntiSpoofHooks.php
___________________________________________________________________
Added: svn:eol-style
113 + native

Follow-up revisions

RevisionCommit summaryAuthorDate
r106812Followup r106809, don't use class_exists, use MWInit::classExists() (I think ...reedy16:51, 20 December 2011
r106813Refactored batchAntiSpoof.php to subclass Maintenance...reedy17:04, 20 December 2011
r111814Actually variablise the table/column we're reading user information from - no...reedy02:48, 18 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106808Do some refactoring to allow easy subclassing stuffsreedy16:17, 20 December 2011

Comments

#Comment by Reedy (talk | contribs)   16:55, 20 December 2011

No scaptrap needed here, in CommonSettings.php AntiSpoof is brought in a few lines before CA is :)

#Comment by RobLa-WMF (talk | contribs)   02:09, 18 February 2012

This seemed to break account creation for 1.19

#Comment by RobLa-WMF (talk | contribs)   02:09, 18 February 2012

Forgot to mention. Aaron has a live hack that he'll be checking in shortly.

Status & tagging log