Use ExtensionRegistry to check, if Echo is installed

Instead of checking, if an internal class exists, it's more
accurate to require an extension and Extensionregistry will
check, if the requirements are fulfilled. If not, it will throw
and exception.

Depends-On: I2bde10ed08048bc0164446dd59d0d4575870fa54
Change-Id: I85a84988c75290d7df63dec27b69b250e305c896
This commit is contained in:
Florian Schmidt 2017-02-04 15:55:02 +01:00 committed by Umherirrender
parent 57bc309d83
commit 3a1a488b23
2 changed files with 5 additions and 6 deletions

View file

@ -88,9 +88,6 @@ class LoginNotifyHooks {
* @param $retval int LoginForm constant (e.g. LoginForm::SUCCESS)
*/
public static function onLoginAuthenticateAudit( User $user, $pass, $retval ) {
if ( !class_exists( 'EchoEvent' ) ) {
throw new FatalError( "LoginNotify extension requires the Echo extension to be installed" );
}
if ( $retval === LoginForm::WRONG_PASS ) {
self::doFailedLogin( $user );
} elseif ( $retval === LoginForm::SUCCESS ) {
@ -108,9 +105,6 @@ class LoginNotifyHooks {
public static function onAuthManagerLoginAuthenticateAudit(
AuthenticationResponse $ret, $user, $username
) {
if ( !class_exists( 'EchoEvent' ) ) {
throw new FatalError( "LoginNotify extension requires the Echo extension to be installed" );
}
if ( $user ) {
$userObj = $user;
} else {

View file

@ -8,6 +8,11 @@
"descriptionmsg": "loginnotify-desc",
"license-name": "MIT",
"type": "other",
"requires": {
"extensions": {
"Echo": "*"
}
},
"DefaultUserOptions": {
"echo-subscriptions-web-login-fail": true,
"echo-subscriptions-email-login-fail": false,