Ori.livneh has submitted this change and it was merged.
Change subject: Partial revert of Idc3d42be7
......................................................................
Partial revert of Idc3d42be7
This patch reverts a change that I piggybacked on Idc3d42be7 without intending
to -- specifically replacing JsonSchemaHooks::registerHandlers with an
anonymous function in EventLogging.php.
This partially reverts commit 068fffb965d857f7f93f911876b6b3d0e3852b13.
Change-Id: I09ebc5abf062c1d74348a6ec199f90bb35769968
---
M EventLogging.php
M includes/JsonSchemaHooks.php
2 files changed, 24 insertions(+), 14 deletions(-)
Approvals:
Ori.livneh: Verified; Looks good to me, approved
diff --git a/EventLogging.php b/EventLogging.php
index 8a24fc8..f269a02 100644
--- a/EventLogging.php
+++ b/EventLogging.php
@@ -186,6 +186,7 @@
$wgAutoloadClasses += array(
// Hooks
'EventLoggingHooks' => __DIR__ . '/EventLogging.hooks.php',
+ 'JsonSchemaHooks' => __DIR__ . '/includes/JsonSchemaHooks.php',
// ContentHandler
'JsonSchemaContent' => __DIR__ .
'/includes/JsonSchemaContent.php',
@@ -248,20 +249,7 @@
// Registers hook and content handlers for JSON schema content iff
// running on the MediaWiki instance housing the schemas.
-$wgExtensionFunctions[] = function () {
- global $wgAutoloadClasses, $wgContentHandlers, $wgDBname,
$wgEventLoggingDBname, $wgHooks;
-
- if ( $wgEventLoggingDBname === $wgDBname ) {
- $wgAutoloadClasses['JsonSchemaHooks'] = __DIR__ .
'/includes/JsonSchemaHooks.php',
-
- $wgContentHandlers[ 'JsonSchema' ] =
'JsonSchemaContentHandler';
-
- $wgHooks[ 'BeforePageDisplay' ][] =
'JsonSchemaHooks::onBeforePageDisplay';
- $wgHooks[ 'CanonicalNamespaces' ][] =
'JsonSchemaHooks::onCanonicalNamespaces';
- $wgHooks[ 'CodeEditorGetPageLanguage' ][] =
'JsonSchemaHooks::onCodeEditorGetPageLanguage';
- $wgHooks[ 'EditFilterMerged' ][] =
'JsonSchemaHooks::onEditFilterMerged';
- }
-}
+$wgExtensionFunctions[] = 'JsonSchemaHooks::registerHandlers';
diff --git a/includes/JsonSchemaHooks.php b/includes/JsonSchemaHooks.php
index 61dcf21..7d64e1b 100644
--- a/includes/JsonSchemaHooks.php
+++ b/includes/JsonSchemaHooks.php
@@ -12,6 +12,28 @@
class JsonSchemaHooks {
/**
+ * Registers hook and content handlers if the JSON Schema
+ * namespace is enabled for this site.
+ * @return bool: Whether hooks and handler were registered.
+ */
+ static function registerHandlers() {
+ global $wgHooks, $wgContentHandlers, $wgEventLoggingDBname,
$wgDBname;
+
+ if ( $wgEventLoggingDBname === $wgDBname ) {
+ $wgContentHandlers[ 'JsonSchema' ] =
'JsonSchemaContentHandler';
+
+ $wgHooks[ 'BeforePageDisplay' ][] =
'JsonSchemaHooks::onBeforePageDisplay';
+ $wgHooks[ 'CanonicalNamespaces' ][] =
'JsonSchemaHooks::onCanonicalNamespaces';
+ $wgHooks[ 'EditFilterMerged' ][] =
'JsonSchemaHooks::onEditFilterMerged';
+ $wgHooks[ 'CodeEditorGetPageLanguage' ][] =
'JsonSchemaHooks::onCodeEditorGetPageLanguage';
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
* Declares JSON as the code editor language for Schema: pages.
* This hook only runs if the CodeEditor extension is enabled.
* @param Title $title
--
To view, visit https://gerrit.wikimedia.org/r/59536
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I09ebc5abf062c1d74348a6ec199f90bb35769968
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/EventLogging
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits