X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FSetup.php;h=2c780617509b30856798675e9a995c41401694cb;hb=db35eca0949cdadc223cb03a01b1112a76c97577;hp=e76ec2cb78759cd7af4643a12575fb5fa8d2e34e;hpb=d245bd25aef1cc7f17f2323ca4d557cd820cc469;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Setup.php b/includes/Setup.php index e76ec2cb78..2c78061750 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -450,6 +450,22 @@ if ( $wgProfileOnly ) { $wgDebugLogFile = ''; } +// Disable AuthManager API modules if $wgDisableAuthManager +if ( $wgDisableAuthManager ) { + $wgAPIModules += [ + 'clientlogin' => 'ApiDisabled', + 'createaccount' => 'ApiCreateAccount', // Use the non-AuthManager version + 'linkaccount' => 'ApiDisabled', + 'unlinkaccount' => 'ApiDisabled', + 'changeauthenticationdata' => 'ApiDisabled', + 'removeauthenticationdata' => 'ApiDisabled', + 'resetpassword' => 'ApiDisabled', + ]; + $wgAPIMetaModules += [ + 'authmanagerinfo' => 'ApiQueryDisabled', + ]; +} + // Backwards compatibility with old password limits if ( $wgMinimalPasswordLength !== false ) { $wgPasswordPolicy['policies']['default']['MinimalPasswordLength'] = $wgMinimalPasswordLength; @@ -501,7 +517,7 @@ if ( !class_exists( 'AutoLoader' ) ) { // Reset the global service locator, so any services that have already been created will be // re-created while taking into account any custom settings and extensions. -MediaWikiServices::resetGlobalInstance( new GlobalVarConfig() ); +MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' ); // Define a constant that indicates that the bootstrapping of the service locator // is complete. @@ -834,15 +850,20 @@ if ( !defined( 'MW_NO_SESSION' ) && !$wgCommandLineMode ) { if ( $sessionUser->getId() === 0 && User::isValidUserName( $sessionUser->getName() ) ) { $ps_autocreate = Profiler::instance()->scopedProfileIn( $fname . '-autocreate' ); if ( $wgDisableAuthManager ) { - MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser ); + $res = MediaWiki\Session\SessionManager::autoCreateUser( $sessionUser ); } else { - MediaWiki\Auth\AuthManager::singleton()->autoCreateUser( + $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser( $sessionUser, - MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSSION, + MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION, true ); } Profiler::instance()->scopedProfileOut( $ps_autocreate ); + \MediaWiki\Logger\LoggerFactory::getInstance( 'authmanager' )->info( 'Autocreation attempt', [ + 'event' => 'autocreate', + 'status' => $res, + ] ); + unset( $res ); } unset( $sessionUser ); }