Merge "Use User::equals() where applicable in the class"
[lhc/web/wiklou.git] / includes / registration / ExtensionRegistry.php
index 7e113fc..787a4b0 100644 (file)
@@ -21,6 +21,11 @@ class ExtensionRegistry {
         */
        const OLDEST_MANIFEST_VERSION = 1;
 
+       /**
+        * Bump whenever the registration cache needs resetting
+        */
+       const CACHE_VERSION = 1;
+
        /**
         * Special key that defines the merge strategy
         *
@@ -76,7 +81,7 @@ class ExtensionRegistry {
                // we don't want to fail here if $wgObjectCaches is not configured
                // properly for APC setup
                try {
-                       $this->cache = ObjectCache::newAccelerator( array() );
+                       $this->cache = ObjectCache::newAccelerator();
                } catch ( MWException $e ) {
                        $this->cache = new EmptyBagOStuff();
                }
@@ -109,7 +114,7 @@ class ExtensionRegistry {
                }
 
                // See if this queue is in APC
-               $key = wfMemcKey( 'registration', md5( json_encode( $this->queued ) ) );
+               $key = wfMemcKey( 'registration', md5( json_encode( $this->queued ) ), self::CACHE_VERSION );
                $data = $this->cache->get( $key );
                if ( $data ) {
                        $this->exportExtractedData( $data );
@@ -182,6 +187,7 @@ class ExtensionRegistry {
                foreach ( $data['credits'] as $credit ) {
                        $data['globals']['wgExtensionCredits'][$credit['type']][] = $credit;
                }
+               $data['globals']['wgExtensionCredits'][self::MERGE_STRATEGY] = 'array_merge_recursive';
                $data['autoload'] = $autoloadClasses;
                return $data;
        }
@@ -216,17 +222,10 @@ class ExtensionRegistry {
                                        $GLOBALS[$key] = array_merge_recursive( $GLOBALS[$key], $val );
                                        break;
                                case 'array_plus_2d':
-                                       // First merge items that are in both arrays
-                                       foreach ( $GLOBALS[$key] as $name => &$groupVal ) {
-                                               if ( isset( $val[$name] ) ) {
-                                                       $groupVal += $val[$name];
-                                               }
-                                       }
-                                       // Now add items that didn't exist yet
-                                       $GLOBALS[$key] += $val;
+                                       $GLOBALS[$key] = wfArrayPlus2d( $GLOBALS[$key], $val );
                                        break;
                                case 'array_plus':
-                                       $GLOBALS[$key] = $val + $GLOBALS[$key];
+                                       $GLOBALS[$key] += $val;
                                        break;
                                case 'array_merge':
                                        $GLOBALS[$key] = array_merge( $val, $GLOBALS[$key] );