mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-11 16:58:38 +00:00
Conditionally register popup RestRoute using ExtensionFunctions
Bug: T362027 Change-Id: Id1329c72b81372468a98da3b47b101302c07b40d
This commit is contained in:
parent
81dedc1909
commit
4c2401961f
|
@ -35,6 +35,9 @@
|
|||
"MathAliasNoTranslate": "Math.alias.noTranslate.php"
|
||||
},
|
||||
"callback": "MediaWiki\\Extension\\Math\\Hooks::onConfig",
|
||||
"ExtensionFunctions": [
|
||||
"MediaWiki\\Extension\\Math\\Hooks::onExtensionFunctions"
|
||||
],
|
||||
"HookHandlers": {
|
||||
"ParserHooksHandler": {
|
||||
"class": "MediaWiki\\Extension\\Math\\HookHandlers\\ParserHooksHandler",
|
||||
|
@ -368,18 +371,5 @@
|
|||
"ServiceWiringFiles": [
|
||||
"ServiceWiring.php"
|
||||
],
|
||||
"RestRoutes": [
|
||||
{
|
||||
"path": "/math/v0/popup/html/{qid}",
|
||||
"method": "GET",
|
||||
"class": "MediaWiki\\Extension\\Math\\Rest\\Popup",
|
||||
"services": [
|
||||
"Math.WikibaseConnector",
|
||||
"LanguageFactory",
|
||||
"LanguageNameUtils",
|
||||
"TitleFactory"
|
||||
]
|
||||
}
|
||||
],
|
||||
"manifest_version": 2
|
||||
}
|
||||
|
|
13
popupRestRoutes.json
Normal file
13
popupRestRoutes.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
[
|
||||
{
|
||||
"path": "/math/v0/popup/html/{qid}",
|
||||
"method": "GET",
|
||||
"class": "MediaWiki\\Extension\\Math\\Rest\\Popup",
|
||||
"services": [
|
||||
"Math.WikibaseConnector",
|
||||
"LanguageFactory",
|
||||
"LanguageNameUtils",
|
||||
"TitleFactory"
|
||||
]
|
||||
}
|
||||
]
|
|
@ -81,6 +81,13 @@ class Hooks implements
|
|||
}
|
||||
}
|
||||
|
||||
public static function onExtensionFunctions() {
|
||||
if ( ExtensionRegistry::getInstance()->isLoaded( 'WikibaseClient' ) ) {
|
||||
global $wgRestAPIAdditionalRouteFiles;
|
||||
$wgRestAPIAdditionalRouteFiles[] = dirname( __DIR__ ) . '/popupRestRoutes.json';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MaintenanceRefreshLinksInit handler; optimize settings for refreshLinks batch job.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue