MaxSem has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/373691 )
Change subject: Even more logging ...................................................................... Even more logging Bug: T173888 Change-Id: I7f9f3cf0657af100c6ae3a8b2bfb5206b86514eb (cherry picked from commit 228a2f3ee3d26d34994c34a17f0e57406728a5d9) --- M includes/LoginNotify.php 1 file changed, 30 insertions(+), 5 deletions(-) Approvals: MaxSem: Verified; Looks good to me, approved diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php index 306aa89..99c46cf 100644 --- a/includes/LoginNotify.php +++ b/includes/LoginNotify.php @@ -160,9 +160,16 @@ */ private function isKnownSystemSlow( User $user, $subnet, $resultSoFar = null ) { $result = $this->checkUserAllWikis( $user, $subnet ); - if ( $result === self::USER_KNOWN ) { - return true; - } + + $this->log->debug( 'Checking user {user} from {subnet} (result so far: {soFar}): {result}', + [ + 'function' => __METHOD__, + 'user' => $user->getName(), + 'subnet' => $subnet, + 'result' => $result, + 'soFar' => json_encode( $resultSoFar ), + ] + ); if ( $resultSoFar !== null ) { $result = $this->mergeResults( $result, $resultSoFar ); @@ -185,7 +192,7 @@ return true; } - return false; + return $result === self::USER_KNOWN; } /** @@ -637,10 +644,20 @@ $this->config->get( 'LoginNotifyAttemptsNewIP' ), $this->config->get( 'LoginNotifyExpiryNewIP' ) ); + $message = '{count} failed login attempts for {user} from an unknown system'; if ( $count ) { $this->incrStats( 'fail.unknown.notifications' ); $this->sendNotice( $user, 'login-fail-new', $count ); + $message .= ', sending notification'; } + + $this->log->debug( $message, + [ + 'function' => __METHOD__, + 'count' => $count, + 'user' => $user->getName(), + ] + ); } /** @@ -796,7 +813,15 @@ */ public function sendSuccessNoticeDeferred( User $user, $subnet, $resultSoFar ) { $isKnown = $this->isKnownSystemSlow( $user, $subnet, $resultSoFar ); - if ( !$isKnown ) { + if ( $isKnown ) { + $this->log->debug( 'Found data for user {user} from {subnet}', + [ + 'function' => __METHOD__, + 'user' => $user->getName(), + 'subnet' => $subnet, + ] + ); + } else { $this->incrStats( 'success.notifications' ); $this->sendNotice( $user, 'login-success' ); } -- To view, visit https://gerrit.wikimedia.org/r/373691 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7f9f3cf0657af100c6ae3a8b2bfb5206b86514eb Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/LoginNotify Gerrit-Branch: wmf/1.30.0-wmf.15 Gerrit-Owner: MaxSem <maxsem.w...@gmail.com> Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits