Merge "convertExtensionToRegistration: Still convert $wgTrackingCategories"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 7 Apr 2015 16:18:19 +0000 (16:18 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 7 Apr 2015 16:18:19 +0000 (16:18 +0000)
1  2 
maintenance/convertExtensionToRegistration.php

@@@ -10,11 -10,19 +10,20 @@@ class ConvertExtensionToRegistration ex
                'AutoloadClasses' => 'removeAbsolutePath',
                'ExtensionCredits' => 'handleCredits',
                'ResourceModules' => 'handleResourceModules',
 +              'ResourceModuleSkinStyles' => 'handleResourceModules',
                'Hooks' => 'handleHooks',
                'ExtensionFunctions' => 'handleExtensionFunctions',
        );
  
+       /**
+        * Things that were formerly globals and should still be converted
+        *
+        * @var array
+        */
+       protected $formerGlobals = array(
+               'TrackingCategories',
+       );
        /**
         * Keys that should be put at the top of the generated JSON file (T86608)
         *
@@@ -45,7 -53,7 +54,7 @@@
                $processor = new ReflectionClass( 'ExtensionProcessor' );
                $settings = $processor->getProperty( 'globalSettings' );
                $settings->setAccessible( true );
-               return $settings->getValue();
+               return $settings->getValue() + $this->formerGlobals;
        }
  
        public function execute() {
        }
  
        protected function handleResourceModules( $realName, $value ) {
 +              $defaults = array();
 +              $remote = $this->hasOption( 'skin' ) ? 'remoteSkinPath' : 'remoteExtPath';
                foreach ( $value as $name => $data ) {
                        if ( isset( $data['localBasePath'] ) ) {
                                $data['localBasePath'] = $this->stripPath( $data['localBasePath'], $this->dir );
 +                              if ( !$defaults ) {
 +                                      $defaults['localBasePath'] = $data['localBasePath'];
 +                                      unset( $data['localBasePath'] );
 +                                      if ( isset( $data[$remote] ) ) {
 +                                              $defaults[$remote] = $data[$remote];
 +                                              unset( $data[$remote] );
 +                                      }
 +                              } else {
 +                                      if ( $data['localBasePath'] === $defaults['localBasePath'] ) {
 +                                              unset( $data['localBasePath'] );
 +                                      }
 +                                      if ( isset( $data[$remote] ) && isset( $defaults[$remote] )
 +                                              && $data[$remote] === $defaults[$remote]
 +                                      ) {
 +                                              unset( $data[$remote] );
 +                                      }
 +                              }
                        }
 +
 +
                        $this->json[$realName][$name] = $data;
                }
 +              if ( $defaults ) {
 +                      $this->json['ResourceFileModulePaths'] = $defaults;
 +              }
        }
  }