'type',
'config',
'config_prefix',
+ 'ServiceWiringFiles',
'ParserTestFiles',
'AutoloadClasses',
'manifest_version',
* @return array
*/
public function extractInfo( $path, array $info, $version ) {
+ $dir = dirname( $path );
if ( $version === 2 ) {
- $this->extractConfig2( $info );
+ $this->extractConfig2( $info, $dir );
} else {
// $version === 1
$this->extractConfig1( $info );
}
$this->extractHooks( $info );
- $dir = dirname( $path );
$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'];
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'];
}
* @todo In the future, this should be done via Config interfaces
*
* @param array $info
+ * @param string $dir
*/
- protected function extractConfig2( array $info ) {
+ protected function extractConfig2( array $info, $dir ) {
if ( isset( $info['config_prefix'] ) ) {
$prefix = $info['config_prefix'];
} else {
foreach ( $info['config'] as $key => $data ) {
$value = $data['value'];
if ( isset( $value['merge_strategy'] ) ) {
- $value[ExtensionRegistry::MERGE_STRATEGY] = $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 ) {