objectcache: Fix DI for MultiWriteBagOStuff sub caches

Follows-up Ia893ddb36427eb5, which added unreachable code because
is_subclass_of is strictly for matching subclasses.

Test plan:
* Add the following to your LocalSettings:
 $wgParserCacheType = 'mysql-multiwrite';
 $wgObjectCaches['mysql-multiwrite'] = [
	'class' => 'MultiWriteBagOStuff',
	'caches' => [
		0 => [
			'factory' => [ 'ObjectCache', 'getInstance' ],
			'args' => [ CACHE_DB ]
		],
		1 => [
			'class' => SqlBagOStuff::class,
			'loggroup' => 'SQLBagOStuff',
			'server' => [
				'type' => 'sqlite',
				'dbname' => 'wikicache',
				'tablePrefix' => '',
				'variables' => [ 'synchronous' => 'NORMAL' ],
				'dbDirectory' => $wgSQLiteDataDir,
				'trxMode' => 'IMMEDIATE',
				'flags' => 0
			]
		],
	],
	'replication' => 'async',
 ];
* Main_Page fatals without this patch, renders with.

Bug: T327158
Change-Id: I59266726ad72e78c9f99d3cc8f9c8838fabed3b5
This commit is contained in:
Timo Tijhof 2023-01-17 12:57:38 +00:00
parent d4bd457684
commit 4e596f5112

View file

@ -204,7 +204,7 @@ class ObjectCache {
}
// Normalization and DI for MultiWriteBagOStuff
if ( is_subclass_of( $class, MultiWriteBagOStuff::class ) ) {
if ( is_a( $class, MultiWriteBagOStuff::class, true ) ) {
// Phan warns about foreach with non-array because it
// thinks any key can be Closure|IBufferingStatsdDataFactory
'@phan-var array{caches:array[]} $params';