use Psr\Log\LoggerInterface;
use BagOStuff;
+use CachedBagOStuff;
use Config;
use FauxRequest;
use Language;
/** @var Config */
private $config;
- /** @var BagOStuff|null */
+ /** @var CachedBagOStuff|null */
private $store;
/** @var SessionProvider[] */
'$options[\'store\'] must be an instance of BagOStuff'
);
}
- $this->store = $options['store'];
+ $store = $options['store'];
} else {
- $this->store = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
- $this->store->setLogger( $this->logger );
+ $store = \ObjectCache::getInstance( $this->config->get( 'SessionCacheType' ) );
+ $store->setLogger( $this->logger );
}
+ $this->store = $store instanceof CachedBagOStuff ? $store : new CachedBagOStuff( $store );
register_shutdown_function( array( $this, 'shutdown' ) );
}
// @codeCoverageIgnoreEnd
}
- # Notify hooks (e.g. Newuserlog)
- \Hooks::run( 'AuthPluginAutoCreate', array( $user ) );
- \Hooks::run( 'LocalUserCreated', array( $user, true ) );
-
- # Notify AuthPlugin too
+ # Notify AuthPlugin
$tmpUser = $user;
$wgAuth->initUser( $tmpUser, true );
if ( $tmpUser !== $user ) {
get_class( $wgAuth ) . '::initUser() replaced the user object' );
}
+ # Notify hooks (e.g. Newuserlog)
+ \Hooks::run( 'AuthPluginAutoCreate', array( $user ) );
+ \Hooks::run( 'LocalUserCreated', array( $user, true ) );
+
$user->saveSettings();
# Update user count
public function preventSessionsForUser( $username ) {
$this->preventUsers[$username] = true;
- // Reset the user's token to kill existing sessions
- $user = User::newFromName( $username );
- if ( $user && $user->getToken() ) {
- $user->setToken( true );
- $user->saveSettings();
- }
-
// Instruct the session providers to kill any other sessions too.
foreach ( $this->getProviders() as $provider ) {
$provider->preventSessionsForUser( $username );