Daniel Kinzler has uploaded a new change for review.
https://gerrit.wikimedia.org/r/71972
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(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/72/71972/1
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: newchange
Gerrit-Change-Id: I924c856232af8e81ac9e55c10a4a22e2f4f6200a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits