Use ExtensionRegistry instead of class_exists

Bug: T183096
Change-Id: I2b02e89f20ecab9dda44ea9a78067a96fc04392c
This commit is contained in:
Derk-Jan Hartman 2018-08-19 17:17:03 +02:00
parent 8d9a584f69
commit 38a70500a0

View file

@ -26,7 +26,7 @@ class WikiEditorHooks {
*/ */
public static function doEventLogging( $action, $article, $data = [] ) { public static function doEventLogging( $action, $article, $data = [] ) {
global $wgVersion; global $wgVersion;
if ( !class_exists( 'EventLogging' ) ) { if ( !ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ) ) {
return false; return false;
} }
// Sample 6.25% (via hex digit) // Sample 6.25% (via hex digit)
@ -87,7 +87,7 @@ class WikiEditorHooks {
// Don't run this if the request was posted - we don't want to log 'init' when the // Don't run this if the request was posted - we don't want to log 'init' when the
// user just pressed 'Show preview' or 'Show changes', or switched from VE keeping // user just pressed 'Show preview' or 'Show changes', or switched from VE keeping
// changes. // changes.
if ( class_exists( 'EventLogging' ) && !$request->wasPosted() ) { if ( ExtensionRegistry::getInstance()->isLoaded( 'EventLogging' ) && !$request->wasPosted() ) {
$data = []; $data = [];
$data['editingSessionId'] = self::getEditingStatsId(); $data['editingSessionId'] = self::getEditingStatsId();
if ( $request->getVal( 'section' ) ) { if ( $request->getVal( 'section' ) ) {