http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97796
Revision: 97796
Author: tstarling
Date: 2011-09-22 06:19:45 +0000 (Thu, 22 Sep 2011)
Log Message:
-----------
Add another hook parameter and extensive documentation to CentralAuthAutoCreate
in an attempt to avoid a repeat of the half-initialised User issues as fixed by
r97794.
Modified Paths:
--------------
trunk/extensions/CentralAuth/CentralAuthHooks.php
Modified: trunk/extensions/CentralAuth/CentralAuthHooks.php
===================================================================
--- trunk/extensions/CentralAuth/CentralAuthHooks.php 2011-09-22 06:17:26 UTC
(rev 97795)
+++ trunk/extensions/CentralAuth/CentralAuthHooks.php 2011-09-22 06:19:45 UTC
(rev 97796)
@@ -461,10 +461,19 @@
return false;
}
- // Give other extensions a chance to stop auto creation,
- // but they cannot change $userName, because CentralAuth
- // expects user names on all wikis are the same.
- if ( !wfRunHooks( 'CentralAuthAutoCreate', array( $user,
$userName ) ) ) {
+ // Give other extensions a chance to stop auto creation, but
they cannot
+ // change $userName, because CentralAuth expects user names on
all wikis
+ // are the same.
+ //
+ // * $user (and usually $wgUser) is the half-created User
object and
+ // should not be accessed in any way since calling any User
methods
+ // in its half-initialised state will give incorrect results.
+ //
+ // * $userName is the new user name
+ //
+ // * $anon is an anonymous user object which can be safely used
for
+ // permissions checks.
+ if ( !wfRunHooks( 'CentralAuthAutoCreate', array( $user,
$userName, $anon ) ) ) {
wfDebug( __METHOD__ . ": denied by other extensions\n"
);
return false;
}
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs