From 313d2e4af1c97afea080e57f200136821591e9d6 Mon Sep 17 00:00:00 2001 From: Umherirrender Date: Fri, 15 Dec 2017 19:01:43 +0100 Subject: [PATCH] Use extension registry to check for CheckUser to be installed Class was renamed in I39c60b2d059d1cb2c1c0d3a4206232d961536697 Change-Id: I8ca79302b9bbd8999e49a134240420d5cd6117c1 --- includes/LoginNotify.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/includes/LoginNotify.php b/includes/LoginNotify.php index 956c629..b5e7d12 100644 --- a/includes/LoginNotify.php +++ b/includes/LoginNotify.php @@ -12,6 +12,7 @@ use BagOStuff; use CentralAuthUser; use Config; use EchoEvent; +use ExtensionRegistry; use IBufferingStatsdDataFactory; use JobQueueGroup; use JobSpecification; @@ -238,7 +239,7 @@ class LoginNotify implements LoggerAwareInterface { Assert::parameter( $user->isLoggedIn(), '$user', 'User must be logged in' ); if ( !$this->config->get( 'LoginNotifyCheckKnownIPs' ) - || !class_exists( 'CheckUser' ) + || !$this->isCheckUserInstalled() ) { // Checkuser checks disabled. // Note: It's important this be USER_NOT_KNOWN and not USER_NO_INFO. @@ -401,6 +402,14 @@ class LoginNotify implements LoggerAwareInterface { return true; } + /** + * Whether CheckUser extension is installed + * @return bool + */ + private function isCheckUserInstalled() { + return ExtensionRegistry::getInstance()->isLoaded( 'CheckUser' ); + } + /** * Give the user a cookie saying that they've previously logged in from this computer. *