From fa186b2e649dce87766ef9d6e3fd952637bf22e7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Gerg=C5=91=20Tisza?= Date: Fri, 17 Jun 2016 00:12:38 +0000 Subject: [PATCH] Handle session reset errors in invalidateSessionsForUser.php Also, do not skip session reset if the user does not exist locally. Change-Id: I5a55e4a6f2d296576ee76e212ed379225251e128 --- maintenance/invalidateUserSessions.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/maintenance/invalidateUserSessions.php b/maintenance/invalidateUserSessions.php index 4b567aec00..11e3372ce6 100644 --- a/maintenance/invalidateUserSessions.php +++ b/maintenance/invalidateUserSessions.php @@ -70,11 +70,17 @@ class InvalidateUserSesssions extends Maintenance { foreach ( $usernames as $username ) { $i++; $user = User::newFromName( $username ); - if ( $user->getId() ) { + try { $sessionManager->invalidateSessionsForUser( $user ); - $this->output( "Invalidated sessions for user $username\n" ); - } else { - $this->output( "Could not find user $username\n" ); + if ( $user->getId() ) { + $this->output( "Invalidated sessions for user $username\n" ); + } else { + # session invalidation might still work if there is a central identity provider + $this->output( "Could not find user $username, tried to invalidate anyway\n" ); + } + } catch ( Exception $e ) { + $this->output( "Failed to invalidate sessions for user $username | " + . str_replace( [ "\r", "\n" ], ' ', $e->getMessage() ) . "\n" ); } if ( $i % $this->mBatchSize ) { -- 2.20.1