Legoktm has uploaded a new change for review. https://gerrit.wikimedia.org/r/309600
Change subject: Check globals in addition to attributes ...................................................................... Check globals in addition to attributes Not all extensions have been converted to use extension.json yet (ZeroBanner) so also make sure we consider anything set in the global variables when looking at the models and configs. Change-Id: Ic32e4e70977d33ab4d0ad9b8ee7058b6d0a734de --- M includes/JCApi.php M includes/JCContent.php M includes/JCSingleton.php 3 files changed, 15 insertions(+), 7 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/JsonConfig refs/changes/00/309600/1 diff --git a/includes/JCApi.php b/includes/JCApi.php index 149e159..8967be6 100644 --- a/includes/JCApi.php +++ b/includes/JCApi.php @@ -50,10 +50,12 @@ $this->getMain()->setCacheMaxAge( 1 * 30 ); // seconds $this->getMain()->setCacheMode( 'public' ); + global $wgJsonConfigModels; $result->addValue( null, 'models', \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + + $wgJsonConfigModels ); $data = array(); diff --git a/includes/JCContent.php b/includes/JCContent.php index 46fb6f1..d37da55 100644 --- a/includes/JCContent.php +++ b/includes/JCContent.php @@ -195,9 +195,10 @@ * @return JCContentView */ protected function getView( $modelId ) { + global $wgJsonConfigModels; $view = $this->view; if ( $view === null ) { - $configModels = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ); + $configModels = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + $wgJsonConfigModels; if ( array_key_exists( $modelId, $configModels ) ) { $value = $configModels[$modelId]; if ( is_array( $value ) && array_key_exists( 'view', $value ) ) { diff --git a/includes/JCSingleton.php b/includes/JCSingleton.php index 8eacbe3..15d98c8 100644 --- a/includes/JCSingleton.php +++ b/includes/JCSingleton.php @@ -65,12 +65,12 @@ return; } $isInitialized = true; - global $wgNamespaceContentModels, $wgContentHandlers; + global $wgNamespaceContentModels, $wgContentHandlers, $wgJsonConfigs, $wgJsonConfigModels; list( self::$titleMap, self::$namespaces ) = self::parseConfiguration( $wgNamespaceContentModels, $wgContentHandlers, - \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ), - \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ) + $wgJsonConfigs, + \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + $wgJsonConfigModels ); } @@ -383,7 +383,8 @@ } public static function getContentClass( $modelId ) { - $configModels = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ); + global $wgJsonConfigModels; + $configModels = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + $wgJsonConfigModels; $class = null; if ( array_key_exists( $modelId, $configModels ) ) { $value = $configModels[$modelId]; @@ -572,12 +573,14 @@ * @return bool */ public static function onContentHandlerForModelID( $modelId, &$handler ) { + global $wgJsonConfigModels; if ( !self::jsonConfigIsStorage() ) { return true; } self::init(); - if ( array_key_exists( $modelId, \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) ) ) { + $models = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigModels' ) + $wgJsonConfigModels; + if ( array_key_exists( $modelId, $models ) ) { // This is one of our model IDs $handler = new JCContentHandler( $modelId ); return false; @@ -779,8 +782,10 @@ private static function jsonConfigIsStorage() { static $isStorage = null; if ( $isStorage === null ) { + global $wgJsonConfigs; $isStorage = false; - foreach ( \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ) as $jc ) { + $configs = \ExtensionRegistry::getInstance()->getAttribute( 'JsonConfigs' ) + $wgJsonConfigs; + foreach ( $configs as $jc ) { if ( ( !array_key_exists( 'isLocal', $jc ) || $jc['isLocal'] ) || ( array_key_exists( 'store', $jc ) ) ) { -- To view, visit https://gerrit.wikimedia.org/r/309600 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic32e4e70977d33ab4d0ad9b8ee7058b6d0a734de Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/JsonConfig Gerrit-Branch: wmf/1.28.0-wmf.18 Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits