Automatically set $wgMainWANCache by default using $wgMainCacheType
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 23 Apr 2015 22:44:19 +0000 (15:44 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 24 Apr 2015 08:37:04 +0000 (01:37 -0700)
Change-Id: If1ad62e4d1f84e01cd4fea04c6dd568c9d290178

includes/DefaultSettings.php
includes/Setup.php

index 25f6206..a16a1f0 100644 (file)
@@ -2170,15 +2170,15 @@ $wgMainWANCache = CACHE_NONE;
 $wgWANObjectCaches = array(
        CACHE_NONE => array(
                'class'         => 'WANObjectCache',
-               'pool'          => 'mediawiki-main-none',
                'cacheId'       => CACHE_NONE,
+               'pool'          => 'mediawiki-main-none',
                'relayerConfig' => array( 'class' => 'EventRelayerNull' )
        )
        /* Example of a simple single data-center cache:
        'memcached-php' => array(
                'class'         => 'WANObjectCache',
-               'pool'          => 'mediawiki-main-memcached',
                'cacheId'       => 'memcached-php',
+               'pool'          => 'mediawiki-main-memcached',
                'relayerConfig' => array( 'class' => 'EventRelayerNull' )
        )
        */
index c5c16a0..b8139d9 100644 (file)
@@ -530,6 +530,18 @@ if ( $wgTmpDirectory === false ) {
 // expecting this to exist. Should be removed sometime 1.26 or later.
 $wgDisableCounters = true;
 
+if ( $wgMainWANCache === false ) {
+       // Setup a WAN cache from $wgMainCacheType with no relayer.
+       // Sites using multiple datacenters can configure a relayer.
+       $wgMainWANCache = 'mediawiki-main-default';
+       $wgWANObjectCaches[$wgMainWANCache] = array(
+               'class'         => 'WANObjectCache',
+               'cacheId'       => $wgMainCacheType,
+               'pool'          => 'mediawiki-main-default',
+               'relayerConfig' => array( 'class' => 'EventRelayerNull' )
+       );
+}
+
 Profiler::instance()->scopedProfileOut( $ps_default2 );
 
 $ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc1' );