Merge "Set default to 1 recent contributor instead of -1"
[lhc/web/wiklou.git] / includes / auth / Throttler.php
index 000b070..8a10ecb 100644 (file)
@@ -23,6 +23,7 @@ namespace MediaWiki\Auth;
 
 use BagOStuff;
 use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerInterface;
 use Psr\Log\LogLevel;
@@ -68,7 +69,7 @@ class Throttler implements LoggerAwareInterface {
                }
 
                if ( $conditions === null ) {
-                       $config = \ConfigFactory::getDefaultInstance()->makeConfig( 'main' );
+                       $config = MediaWikiServices::getInstance()->getMainConfig();
                        $conditions = $config->get( 'PasswordAttemptThrottle' );
                        $params += [
                                'type' => 'password',
@@ -129,7 +130,7 @@ class Throttler implements LoggerAwareInterface {
                        $throttleKey = wfGlobalCacheKey( 'throttler', $this->type, $index, $ipKey, $userKey );
                        $throttleCount = $this->cache->get( $throttleKey );
 
-                       if ( !$throttleCount ) {  // counter not started yet
+                       if ( !$throttleCount ) { // counter not started yet
                                $this->cache->add( $throttleKey, 1, $expiry );
                        } elseif ( $throttleCount < $count ) { // throttle limited not yet reached
                                $this->cache->incr( $throttleKey );