jenkins-bot has submitted this change and it was merged.

Change subject: (bug 45167) use SetupAfterCache to register templates.
......................................................................


(bug 45167) use SetupAfterCache to register templates.

Avoid using $wgExtensionFunctions in general, and especially
with closures, since they look odd on Special:Version.

Change-Id: I924c856232af8e81ac9e55c10a4a22e2f4f6200a
---
M lib/WikibaseLib.php
1 file changed, 11 insertions(+), 6 deletions(-)

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



diff --git a/lib/WikibaseLib.php b/lib/WikibaseLib.php
index 3ce122c..5a9fc13 100644
--- a/lib/WikibaseLib.php
+++ b/lib/WikibaseLib.php
@@ -104,12 +104,6 @@
        // i18n
        $wgExtensionMessagesFiles['WikibaseLib'] = __DIR__ . 
'/WikibaseLib.i18n.php';
 
-       // TODO: this is not nice, figure out a better design
-       $wgExtensionFunctions[] = function() {
-               \Wikibase\TemplateRegistry::singleton()->addTemplates( include( 
__DIR__ . "/resources/templates.php" ) );
-               return true;
-       };
-
        $wgValueParsers['wikibase-entityid'] = 'Wikibase\Lib\EntityIdParser';
        $wgDataValues['wikibase-entityid'] = 'Wikibase\EntityId';
        $wgJobClasses['ChangeNotification'] = 'Wikibase\ChangeNotificationJob';
@@ -138,6 +132,17 @@
        };
 
        /**
+        * Called when setup is done. This is somewhat ugly, find a better time 
to register templates.
+        * @see https://www.mediawiki.org/wiki/Manual:Hooks/SetupAfterCache
+        *
+        * @return bool
+        */
+       $wgHooks['SetupAfterCache'][] = function() {
+               \Wikibase\TemplateRegistry::singleton()->addTemplates( include( 
__DIR__ . "/resources/templates.php" ) );
+               return true;
+       };
+
+       /**
         * Shorthand function to retrieve a template filled with the specified 
parameters.
         *
         * @since 0.2

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I924c856232af8e81ac9e55c10a4a22e2f4f6200a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Aude <aude.w...@gmail.com>
Gerrit-Reviewer: Daniel Werner <daniel.wer...@wikimedia.de>
Gerrit-Reviewer: Denny Vrandecic <denny.vrande...@wikimedia.de>
Gerrit-Reviewer: Hoo man <h...@online.de>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to