Esanders has uploaded a new change for review. https://gerrit.wikimedia.org/r/236028
Change subject: Provide alternative access to citoid-template-type-map.json ...................................................................... Provide alternative access to citoid-template-type-map.json This is a temporary workaround while we investigate the cause of this bug. Bug: T93800 Change-Id: Iccc4df3cc5c7e59010cf91b5a12343088f44b7ce --- A CitoidDataModule.php M extension.json M modules/ve.ui.CiteFromIdInspectorTool.js 3 files changed, 62 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Citoid refs/changes/28/236028/1 diff --git a/CitoidDataModule.php b/CitoidDataModule.php new file mode 100644 index 0000000..efc2083 --- /dev/null +++ b/CitoidDataModule.php @@ -0,0 +1,49 @@ +<?php +/** + * Resource loader module providing extra data from the server to Citoid. + * + * Temporary hack for T93800 + * + * @file + * @ingroup Extensions + * @copyright 2011-2015 Citoid Team and others; see AUTHORS.txt + * @license The MIT License (MIT); see LICENSE.txt + */ + +class CitoidDataModule extends ResourceLoaderModule { + + /* Protected Members */ + + protected $origin = self::ORIGIN_USER_SITEWIDE; + protected $targets = array( 'desktop', 'mobile' ); + + /* Methods */ + + public function __construct() { + } + + public function getScript( ResourceLoaderContext $context ) { + return + 've.init.platform.addMessages(' . FormatJson::encode( + array( + 'citoid-template-type-map-backup.json' => wfMessage( 'citoid-template-type-map.json' )->plain() + ), + ResourceLoader::inDebugMode() + ) . ');'; + } + + public function getDependencies( ResourceLoaderContext $context = null ) { + return array( + 'ext.visualEditor.base', + 'ext.visualEditor.mediawiki', + ); + } + + public function getDefinitionSummary( ResourceLoaderContext $context ) { + $summary = parent::getDefinitionSummary( $context ); + $summary[] = array( + 'script' => $this->getScript( $context ), + ); + return $summary; + } +} diff --git a/extension.json b/extension.json index 11a502f..86c6de7 100644 --- a/extension.json +++ b/extension.json @@ -16,7 +16,8 @@ ] }, "AutoloadClasses": { - "CitoidHooks": "Citoid.hooks.php" + "CitoidHooks": "Citoid.hooks.php", + "CitoidDataModule": "CitoidDataModule.php" }, "ResourceModules": { "ext.citoid.visualEditor": { @@ -36,7 +37,8 @@ "ext.visualEditor.mwreference", "json", "ext.visualEditor.mediawiki", - "mediawiki.api.options" + "mediawiki.api.options", + "ext.citoid.visualEditor.data" ], "messages": [ "citoid-520-error", @@ -60,6 +62,9 @@ "desktop", "mobile" ] + }, + "ext.citoid.visualEditor.data": { + "class": "CitoidDataModule" } }, "ResourceFileModulePaths": { diff --git a/modules/ve.ui.CiteFromIdInspectorTool.js b/modules/ve.ui.CiteFromIdInspectorTool.js index e2bbdc8..2b7dd89 100644 --- a/modules/ve.ui.CiteFromIdInspectorTool.js +++ b/modules/ve.ui.CiteFromIdInspectorTool.js @@ -3,7 +3,12 @@ try { JSON.parse( mw.message( 'citoid-template-type-map.json' ).plain() ); } catch ( e ) { - return; + // Temporary hack for T93800 + try { + JSON.parse( mw.message( 'citoid-template-type-map-backup.json' ).plain() ); + } catch ( e ) { + return; + } } // HACK: Find the position of the current citation toolbar definition -- To view, visit https://gerrit.wikimedia.org/r/236028 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iccc4df3cc5c7e59010cf91b5a12343088f44b7ce Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Citoid Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits