'editmyuserjs',
'editmywatchlist',
'editsemiprotected',
- 'editusercssjs', #deprecated
+ 'editusercssjs', # deprecated
'editusercss',
'edituserjs',
'hideuser',
protected static $mAllRights = false;
/** Cache variables */
- //@{
+ // @{
public $mId;
/** @var string */
public $mName;
protected $mOptionOverrides;
/** @var string */
protected $mPasswordExpires;
- //@}
+ // @}
/**
* Bool Whether the cache variables have been loaded.
*/
- //@{
+ // @{
public $mOptionsLoaded;
/**
* Array with already loaded items or true if all items have been loaded.
*/
protected $mLoadedItems = array();
- //@}
+ // @}
/**
* String Initialization data source if mLoadedItems!==true. May be one of:
}
/** @name newFrom*() static factory methods */
- //@{
+ // @{
/**
* Static factory method for creation from username.
return $user;
}
- //@}
+ // @}
/**
* Get the username corresponding to a given user ID
* @return bool
*/
public function isValidPassword( $password ) {
- //simple boolean wrapper for getPasswordValidity
+ // simple boolean wrapper for getPasswordValidity
return $this->getPasswordValidity( $password ) === true;
}
);
$status = Status::newGood();
- $result = false; //init $result to false for the internal checks
+ $result = false; // init $result to false for the internal checks
if ( !Hooks::run( 'isValidPassword', array( $password, &$result, $this ) ) ) {
$status->error( $result );
return $status;
} else {
$status->error( $result );
- return $status; //the isValidPassword hook set a string $result and returned true
+ return $status; // the isValidPassword hook set a string $result and returned true
}
}
foreach ( $toPromote as $group ) {
$this->addGroup( $group );
}
-
// update groups in external authentication database
+ Hooks::run( 'UserGroupsChanged', array( $this, $toPromote, array(), false ) );
$wgAuth->updateExternalDBGroups( $this, $toPromote );
$newGroups = array_merge( $oldGroups, $toPromote ); // all groups
# We only need to worry about passing the IP address to the Block generator if the
# user is not immune to autoblocks/hardblocks, and they are the current user so we
# know which IP address they're actually coming from
- if ( !$this->isAllowed( 'ipblock-exempt' ) && $this->getID() == $wgUser->getID() ) {
+ if ( !$this->isAllowed( 'ipblock-exempt' ) && $this->equals( $wgUser ) ) {
$ip = $this->getRequest()->getIP();
} else {
$ip = null;
foreach ( (array)$bases as $base ) {
// Make hostname
// If we have an access key, use that too (ProjectHoneypot, etc.)
+ $basename = $base;
if ( is_array( $base ) ) {
if ( count( $base ) >= 2 ) {
// Access key is 1, base URL is 0
} else {
$host = "$ipReversed.{$base[0]}";
}
+ $basename = $base[0];
} else {
$host = "$ipReversed.$base";
}
$ipList = gethostbynamel( $host );
if ( $ipList ) {
- wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $base!" );
+ wfDebugLog( 'dnsblacklist', "Hostname $host is {$ipList[0]}, it's a proxy says $basename!" );
$found = true;
break;
} else {
- wfDebugLog( 'dnsblacklist', "Requested $host, not found in $base." );
+ wfDebugLog( 'dnsblacklist', "Requested $host, not found in $basename." );
}
}
}
global $wgAuth;
$authUser = $wgAuth->getUserInstance( $this );
$this->mLocked = (bool)$authUser->isLocked();
+ Hooks::run( 'UserIsLocked', array( $this, &$this->mLocked ) );
return $this->mLocked;
}
global $wgAuth;
$authUser = $wgAuth->getUserInstance( $this );
$this->mHideName = (bool)$authUser->isHidden();
+ Hooks::run( 'UserIsHidden', array( $this, &$this->mHideName ) );
}
return $this->mHideName;
}
*/
public function clearSharedCache() {
$id = $this->getId();
- if ( $id ) {
- $key = wfMemcKey( 'user', 'id', $id );
- ObjectCache::getMainWANInstance()->delete( $key );
+ if ( !$id ) {
+ return;
}
+
+ $key = wfMemcKey( 'user', 'id', $id );
+ wfGetDB( DB_MASTER )->onTransactionPreCommitOrIdle( function() use ( $key ) {
+ ObjectCache::getMainWANInstance()->delete( $key );
+ } );
}
/**
Hooks::run( 'UserSaveSettings', array( $this ) );
$this->clearSharedCache();
$this->getUserPage()->invalidateCache();
-
- // T95839: clear the cache again post-commit to reduce race conditions
- // where stale values are written back to the cache by other threads.
- // Note: this *still* doesn't deal with REPEATABLE-READ snapshot lag...
- $that = $this;
- $dbw->onTransactionIdle( function() use ( $that ) {
- $that->clearSharedCache();
- } );
}
/**
# is b0rked anyway in some browsers, just return nothing. When it's
# re-enabled, fix this code to not output required for e-mail
# registration.
- #$ret = array( 'required' );
+ # $ret = array( 'required' );
$ret = array();
# We can't actually do this right now, because Opera 9.6 will print out