mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-12-04 12:09:04 +00:00
Conditionally register popup RestRoute using ExtensionFunctions
Bug: T362027
Change-Id: Id1329c72b81372468a98da3b47b101302c07b40d
(cherry picked from commit 4c2401961f
)
This commit is contained in:
parent
9e0699f2b9
commit
4c9eaed7a3
|
@ -34,6 +34,9 @@
|
|||
"MathAlias": "Math.alias.php",
|
||||
"MathAliasNoTranslate": "Math.alias.noTranslate.php"
|
||||
},
|
||||
"ExtensionFunctions": [
|
||||
"MediaWiki\\Extension\\Math\\Hooks::onExtensionFunctions"
|
||||
],
|
||||
"HookHandlers": {
|
||||
"ParserHooksHandler": {
|
||||
"class": "MediaWiki\\Extension\\Math\\HookHandlers\\ParserHooksHandler",
|
||||
|
@ -388,18 +391,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"
|
||||
]
|
||||
}
|
||||
]
|
|
@ -17,6 +17,13 @@ use RequestContext;
|
|||
|
||||
class Hooks {
|
||||
|
||||
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