diff options
author | daniel <dkinzler@wikimedia.org> | 2023-01-25 16:11:10 +0100 |
---|---|---|
committer | Daniel Kinzler <dkinzler@wikimedia.org> | 2023-02-16 21:11:33 +0000 |
commit | 7dcfbf2a6263278a7385f380778584d084a79a92 (patch) | |
tree | da9aae8198110ac0fccf9d253c6a19d8449730b2 /includes/objectcache/ObjectCache.php | |
parent | fd660e4c519db8a568050455662d25a132cfb278 (diff) | |
download | mediawikicore-7dcfbf2a6263278a7385f380778584d084a79a92.tar.gz mediawikicore-7dcfbf2a6263278a7385f380778584d084a79a92.zip |
Allow some maintenance scripts to be called without a LocalSettings
Subclasses of Maintenance that can function without database access can
now override canExecuteWithoutLocalSettings to return true.
This is useful for scripts that need to be able to run before or without
installing MediaWiki.
When no config file is present, the storage backend will be disabled.
Any attempt to access the database will result in an error.
NOTE: This makes MediaWikiServices::disableBackendServices() more
comprehensive, to avoid premature failures during service
construction. This change makes it necessary to adjust how the
installer manages service overrides.
The CLI installer is covered by CI, I tested the web installer
manually.
Change-Id: Ie84010c80f32cbdfd34aff9dde1bfde1ed531793
Diffstat (limited to 'includes/objectcache/ObjectCache.php')
-rw-r--r-- | includes/objectcache/ObjectCache.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/includes/objectcache/ObjectCache.php b/includes/objectcache/ObjectCache.php index b9beeb54f959..b6505ee7088f 100644 --- a/includes/objectcache/ObjectCache.php +++ b/includes/objectcache/ObjectCache.php @@ -246,9 +246,14 @@ class ObjectCache { } } - if ( MediaWikiServices::getInstance()->isServiceDisabled( 'DBLoadBalancer' ) ) { - // The LoadBalancer is disabled, probably because - // MediaWikiServices::disableStorageBackend was called. + $services = MediaWikiServices::getInstance(); + + if ( $services->isServiceDisabled( 'DBLoadBalancer' ) ) { + // The DBLoadBalancer service is disabled, so we can't use the database! + $candidate = CACHE_NONE; + } elseif ( $services->isStorageDisabled() ) { + // Storage services are disabled because MediaWikiServices::disableStorage() + // was called. This is typically the case during installation. $candidate = CACHE_NONE; } else { $candidate = CACHE_DB; |