Demote "throttler data not found" logs to info level
authorGergő Tisza <tgr.huwiki@gmail.com>
Fri, 17 Feb 2017 00:47:49 +0000 (16:47 -0800)
committerGergő Tisza <gtisza@wikimedia.org>
Fri, 17 Feb 2017 00:59:07 +0000 (00:59 +0000)
Bug: T158364
Change-Id: I049c2d6da4720341ef2a380879ac19aff444b1d0

includes/auth/ThrottlePreAuthenticationProvider.php
tests/phpunit/includes/auth/ThrottlePreAuthenticationProviderTest.php

index 3f6a47d..ae0bc6b 100644 (file)
@@ -167,7 +167,9 @@ class ThrottlePreAuthenticationProvider extends AbstractPreAuthenticationProvide
 
                $data = $this->manager->getAuthenticationSessionData( 'LoginThrottle' );
                if ( !$data ) {
-                       $this->logger->error( 'throttler data not found for {user}', [ 'user' => $user->getName() ] );
+                       // this can occur when login is happening via AuthenticationRequest::$loginRequest
+                       // so testForAuthentication is skipped
+                       $this->logger->info( 'throttler data not found for {user}', [ 'user' => $user->getName() ] );
                        return;
                }
 
index 20f4cbc..2f3e27c 100644 (file)
@@ -226,7 +226,7 @@ class ThrottlePreAuthenticationProviderTest extends \MediaWikiTestCase {
                $provider->postAuthentication( \User::newFromName( 'SomeUser' ),
                        AuthenticationResponse::newPass() );
                $this->assertSame( [
-                       [ \Psr\Log\LogLevel::ERROR, 'throttler data not found for {user}' ],
+                       [ \Psr\Log\LogLevel::INFO, 'throttler data not found for {user}' ],
                ], $logger->getBuffer() );
        }
 }