From 734e2af35c09d3c906a7e11bb965b19c99f2a644 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 22 Jun 2021 17:18:17 +0200 Subject: [PATCH] Put onMediaWikiServices into a separate handler class. The MediaWikiServices hook runs before the service container is fully initialized, so it cannot have services injected. For this reason, it needs to be separate from the handlers for other hooks. Change-Id: I1519aea8bca2f3977fcf15ee8776a1b3319687b5 --- extension.json | 5 ++- includes/ConfigHookHandler.php | 62 ++++++++++++++++++++++++++++++++++ includes/Hooks.php | 26 -------------- 3 files changed, 66 insertions(+), 27 deletions(-) create mode 100644 includes/ConfigHookHandler.php diff --git a/extension.json b/extension.json index ceba5438..87ba8d37 100644 --- a/extension.json +++ b/extension.json @@ -85,10 +85,13 @@ "default": { "class": "MediaWiki\\Extension\\CategoryTree\\Hooks", "services": [ "DBLoadBalancer", "MainConfig" ] + }, + "config": { + "class": "MediaWiki\\Extension\\CategoryTree\\ConfigHookHandler" } }, "Hooks": { - "MediaWikiServices": "default", + "MediaWikiServices": "config", "ArticleFromTitle": "default", "SpecialTrackingCategories::preprocess": "default", "SpecialTrackingCategories::generateCatLink": "default", diff --git a/includes/ConfigHookHandler.php b/includes/ConfigHookHandler.php new file mode 100644 index 00000000..0c3c98a5 --- /dev/null +++ b/includes/ConfigHookHandler.php @@ -0,0 +1,62 @@ +