Currently, $wgSharedTables - if configured - is injected into the LoadBalancer
before the WAN cache autodetection runs. As such, if $wgSharedTables is set
but $wgMainWANCache was not explicitly given, the LoadBalancer will force
a premature instantion of the WAN cache with an EmptyBagOStuff backend,
preventing the autodetection logic from setting a correct backend.
This change moves $wgSharedTables initialization after the WAN cache
autodetection to accunt for this scenario.
Change-Id: I59bb52f42905cda1c2aa47bc589a2f0b36b2a28f
// re-created while taking into account any custom settings and extensions.
MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
// re-created while taking into account any custom settings and extensions.
MediaWikiServices::resetGlobalInstance( new GlobalVarConfig(), 'quick' );
-if ( $wgSharedDB && $wgSharedTables ) {
- // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
- MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
- array_fill_keys(
- $wgSharedTables,
- [
- 'dbname' => $wgSharedDB,
- 'schema' => $wgSharedSchema,
- 'prefix' => $wgSharedPrefix
- ]
- )
- );
-}
-
// Define a constant that indicates that the bootstrapping of the service locator
// is complete.
define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
// Define a constant that indicates that the bootstrapping of the service locator
// is complete.
define( 'MW_SERVICE_BOOTSTRAP_COMPLETE', 1 );
+if ( $wgSharedDB && $wgSharedTables ) {
+ // Apply $wgSharedDB table aliases for the local LB (all non-foreign DB connections)
+ MediaWikiServices::getInstance()->getDBLoadBalancer()->setTableAliases(
+ array_fill_keys(
+ $wgSharedTables,
+ [
+ 'dbname' => $wgSharedDB,
+ 'schema' => $wgSharedSchema,
+ 'prefix' => $wgSharedPrefix
+ ]
+ )
+ );
+}
+
Profiler::instance()->scopedProfileOut( $ps_default2 );
$ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' );
Profiler::instance()->scopedProfileOut( $ps_default2 );
$ps_misc = Profiler::instance()->scopedProfileIn( $fname . '-misc' );