Nikerabbit has submitted this change and it was merged.

Change subject: Use EventLoggingRegisterSchemas for eventlogging registration
......................................................................


Use EventLoggingRegisterSchemas for eventlogging registration

Bug: T88401
Change-Id: I24d76373383ff78a67b6a93f5a4c9c96a1cfe3cc
---
M ContentTranslation.hooks.php
M ContentTranslation.php
2 files changed, 12 insertions(+), 28 deletions(-)

Approvals:
  Nikerabbit: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/ContentTranslation.hooks.php b/ContentTranslation.hooks.php
index 4cdd485..7bf97da 100644
--- a/ContentTranslation.hooks.php
+++ b/ContentTranslation.hooks.php
@@ -94,6 +94,17 @@
        }
 
        /**
+        * Hook: EventLoggingRegisterSchemas
+        */
+       public static function addEventLogging( array &$schemas ) {
+               global $wgContentTranslationEventLogging;
+
+               if ( $wgContentTranslationEventLogging ) {
+                       $schemas['ContentTranslation'] = 7146627;
+               }
+       }
+
+       /**
         * Hook: SpecialContributionsBeforeMainOutput
         * @param int $id
         * @param User $user
diff --git a/ContentTranslation.php b/ContentTranslation.php
index 017814e..14d7b4d 100644
--- a/ContentTranslation.php
+++ b/ContentTranslation.php
@@ -62,36 +62,9 @@
 $GLOBALS['wgHooks']['BeforePageDisplay'][] = 
'ContentTranslationHooks::addModules';
 $GLOBALS['wgHooks']['GetBetaFeaturePreferences'][] = 
'ContentTranslationHooks::getPreferences';
 $GLOBALS['wgHooks']['ResourceLoaderGetConfigVars'][] = 
'ContentTranslationHooks::addConfig';
+$GLOBALS['wgHooks']['EventLoggingRegisterSchemas'][] = 
'ContentTranslationHooks::addEventLogging';
 $GLOBALS['wgHooks']['SpecialContributionsBeforeMainOutput'][] =
        'ContentTranslationHooks::addNewContributionButton';
-
-$GLOBALS['wgExtensionFunctions'][] = function () {
-       global $wgResourceModules, $wgContentTranslationEventLogging;
-
-       // If EventLogging integration is enabled, first ensure that the
-       // EventLogging extension is present, then declare the schema module.
-       // If it is not present, emit a warning and disable logging.
-       if ( $wgContentTranslationEventLogging ) {
-               if ( class_exists( 'ResourceLoaderSchemaModule' ) ) {
-                       /// @see 
https://meta.wikimedia.org/wiki/Schema:ContentTranslation
-                       $wgResourceModules[ 'schema.ContentTranslation' ] = 
array(
-                               'class'  => 'ResourceLoaderSchemaModule',
-                               'schema' => 'ContentTranslation',
-                               'revision' => 7146627,
-                       );
-               } else {
-                       wfWarn(
-                               'ContentTranslation is configured to use 
EventLogging, ' .
-                               'but the extension is is not available. ' .
-                               'Disabling $wgContentTranslationEventLogging.'
-                       );
-                       $wgContentTranslationEventLogging = false;
-               }
-       }
-
-       return true;
-};
-
 // Globals for this extension
 
 $GLOBALS['wgContentTranslationExperimentalFeatures'] = false;

-- 
To view, visit https://gerrit.wikimedia.org/r/188321
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I24d76373383ff78a67b6a93f5a4c9c96a1cfe3cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to