From: Gergő Tisza Date: Fri, 17 Jun 2016 00:12:38 +0000 (+0000) Subject: Handle session reset errors in invalidateSessionsForUser.php X-Git-Tag: 1.31.0-rc.0~6577^2 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=fa186b2e649dce87766ef9d6e3fd952637bf22e7;p=lhc%2Fweb%2Fwiklou.git Handle session reset errors in invalidateSessionsForUser.php Also, do not skip session reset if the user does not exist locally. Change-Id: I5a55e4a6f2d296576ee76e212ed379225251e128 --- 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 ) {