X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fregistration%2FExtensionProcessor.php;h=745c233b514121efd46f3973abe21ac0d3a93615;hb=8c261ee924ae27dcfca694f5e5233e81f12f5dc9;hp=ea1799064fd4a6b8f13e1414f9886a9e075b8658;hpb=c6bc3b13f8a469c31fbc2a0345ca782002a77dd8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/registration/ExtensionProcessor.php b/includes/registration/ExtensionProcessor.php index ea1799064f..745c233b51 100644 --- a/includes/registration/ExtensionProcessor.php +++ b/includes/registration/ExtensionProcessor.php @@ -109,6 +109,8 @@ class ExtensionProcessor implements Processor { 'MessagesDirs', 'type', 'config', + 'config_prefix', + 'ServiceWiringFiles', 'ParserTestFiles', 'AutoloadClasses', 'manifest_version', @@ -161,13 +163,19 @@ class ExtensionProcessor implements Processor { * @return array */ public function extractInfo( $path, array $info, $version ) { - $this->extractConfig( $info ); - $this->extractHooks( $info ); $dir = dirname( $path ); + if ( $version === 2 ) { + $this->extractConfig2( $info, $dir ); + } else { + // $version === 1 + $this->extractConfig1( $info ); + } + $this->extractHooks( $info ); $this->extractExtensionMessagesFiles( $dir, $info ); $this->extractMessagesDirs( $dir, $info ); $this->extractNamespaces( $info ); $this->extractResourceLoaderModules( $dir, $info ); + $this->extractServiceWiringFiles( $dir, $info ); $this->extractParserTestFiles( $dir, $info ); if ( isset( $info['callback'] ) ) { $this->callbacks[] = $info['callback']; @@ -237,7 +245,10 @@ class ExtensionProcessor implements Processor { foreach ( $info['namespaces'] as $ns ) { $id = $ns['id']; $this->defines[$ns['constant']] = $id; - $this->attributes['ExtensionNamespaces'][$id] = $ns['name']; + if ( !( isset( $ns['conditional'] ) && $ns['conditional'] ) ) { + // If it is not conditional, register it + $this->attributes['ExtensionNamespaces'][$id] = $ns['name']; + } if ( isset( $ns['gender'] ) ) { $this->globals['wgExtraGenderNamespaces'][$id] = $ns['gender']; } @@ -349,12 +360,12 @@ class ExtensionProcessor implements Processor { } /** - * Set configuration settings + * Set configuration settings for manifest_version == 1 * @todo In the future, this should be done via Config interfaces * * @param array $info */ - protected function extractConfig( array $info ) { + protected function extractConfig1( array $info ) { if ( isset( $info['config'] ) ) { if ( isset( $info['config']['_prefix'] ) ) { $prefix = $info['config']['_prefix']; @@ -370,6 +381,41 @@ class ExtensionProcessor implements Processor { } } + /** + * Set configuration settings for manifest_version == 2 + * @todo In the future, this should be done via Config interfaces + * + * @param array $info + * @param string $dir + */ + protected function extractConfig2( array $info, $dir ) { + if ( isset( $info['config_prefix'] ) ) { + $prefix = $info['config_prefix']; + } else { + $prefix = 'wg'; + } + if ( isset( $info['config'] ) ) { + foreach ( $info['config'] as $key => $data ) { + $value = $data['value']; + if ( isset( $value['merge_strategy'] ) ) { + $value[ExtensionRegistry::MERGE_STRATEGY] = $data['merge_strategy']; + } + if ( isset( $data['path'] ) && $data['path'] ) { + $value = "$dir/$value"; + } + $this->globals["$prefix$key"] = $value; + } + } + } + + protected function extractServiceWiringFiles( $dir, array $info ) { + if ( isset( $info['ServiceWiringFiles'] ) ) { + foreach ( $info['ServiceWiringFiles'] as $path ) { + $this->globals['wgServiceWiringFiles'][] = "$dir/$path"; + } + } + } + protected function extractParserTestFiles( $dir, array $info ) { if ( isset( $info['ParserTestFiles'] ) ) { foreach ( $info['ParserTestFiles'] as $path ) {