From: Kunal Mehta Date: Mon, 18 May 2015 05:48:58 +0000 (-0700) Subject: registration: Remove implementation of custom processors for now X-Git-Tag: 1.31.0-rc.0~11360^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/?a=commitdiff_plain;h=c573fc5a47204d29314;hp=c68e70e8731f482c56b73679ee25dfb5a626176d;p=lhc%2Fweb%2Fwiklou.git registration: Remove implementation of custom processors for now The current implementation is broken due to the array_merge_recursive it does on all the data, which would have broken things like $wgGroupPermissions which requires special handling. Remove the current implementation for now while we re-evaluatate how to do this properly, and whether it is even needed. Bug: T99492 Change-Id: I886892e6fd12d51446ede4fc7e6ef1371542b77e --- diff --git a/includes/registration/ExtensionRegistry.php b/includes/registration/ExtensionRegistry.php index d938f07272..40ae2ebf82 100644 --- a/includes/registration/ExtensionRegistry.php +++ b/includes/registration/ExtensionRegistry.php @@ -38,13 +38,6 @@ class ExtensionRegistry { */ protected $attributes = array(); - /** - * Processors, 'default' should be set by subclasses in the constructor - * - * @var Processor[] - */ - protected $processors = array(); - /** * @var ExtensionRegistry */ @@ -119,6 +112,7 @@ class ExtensionRegistry { public function readFromQueue( array $queue ) { $data = array( 'globals' => array( 'wgAutoloadClasses' => array() ) ); $autoloadClasses = array(); + $processor = new ExtensionProcessor(); foreach ( $queue as $path => $mtime ) { $json = file_get_contents( $path ); if ( $json === false ) { @@ -132,36 +126,18 @@ class ExtensionRegistry { // Set up the autoloader now so custom processors will work $GLOBALS['wgAutoloadClasses'] += $autoload; $autoloadClasses += $autoload; - if ( isset( $info['processor'] ) ) { - $processor = $this->getProcessor( $info['processor'] ); - } else { - $processor = $this->getProcessor( 'default' ); - } $processor->extractInfo( $path, $info ); } - foreach ( $this->processors as $processor ) { - $data = array_merge_recursive( $data, $processor->getExtractedInfo() ); - } + $data = $processor->getExtractedInfo(); + // Need to set this so we can += to it later + $data['globals']['wgAutoloadClasses'] = array(); foreach ( $data['credits'] as $credit ) { $data['globals']['wgExtensionCredits'][$credit['type']][] = $credit; } - $this->processors = array(); // Reset $data['autoload'] = $autoloadClasses; return $data; } - protected function getProcessor( $type ) { - if ( !isset( $this->processors[$type] ) ) { - $processor = $type === 'default' ? new ExtensionProcessor() : new $type(); - if ( !$processor instanceof Processor ) { - throw new Exception( "$type is not a Processor" ); - } - $this->processors[$type] = $processor; - } - - return $this->processors[$type]; - } - protected function exportExtractedData( array $info ) { foreach ( $info['globals'] as $key => $val ) { if ( !isset( $GLOBALS[$key] ) || !$GLOBALS[$key] ) {