X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fdb%2FMWLBFactory.php;h=fe063f20b15f37d1e75cd4b01be6f664fa50ffb8;hp=40418fd47929fc6ba8245e5adf76f855389daac0;hb=49748181dd56ec97e7ba7c13e684a16abceb3cc0;hpb=638becad9826f135e9ab47ad4a9ca24b6ec6cc09 diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php index 40418fd479..fe063f20b1 100644 --- a/includes/db/MWLBFactory.php +++ b/includes/db/MWLBFactory.php @@ -23,6 +23,7 @@ use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; +use Wikimedia\Rdbms\DatabaseDomain; /** * MediaWiki-specific class for generating database load balancers @@ -58,6 +59,9 @@ abstract class MWLBFactory { 'readOnlyReason' => wfConfiguredReadOnlyReason(), ]; + // When making changes here, remember to also specify MediaWiki-specific options + // for Database classes in the relevant Installer subclass. + // Such as MysqlInstaller::openConnection and PostgresInstaller::openConnectionWithParams. if ( $lbConf['class'] === 'LBFactorySimple' ) { if ( isset( $lbConf['servers'] ) ) { // Server array is already explicitly configured; leave alone @@ -71,7 +75,13 @@ abstract class MWLBFactory { // Work around the reserved word usage in MediaWiki schema 'keywordTableMap' => [ 'user' => 'mwuser', 'text' => 'pagecontent' ] ]; + } elseif ( $server['type'] === 'mssql' ) { + $server += [ + 'port' => $mainConfig->get( 'DBport' ), + 'useWindowsAuth' => $mainConfig->get( 'DBWindowsAuthentication' ) + ]; } + if ( in_array( $server['type'], $typesWithSchema, true ) ) { $server += [ 'schema' => $mainConfig->get( 'DBmwschema' ) ]; } @@ -111,6 +121,9 @@ abstract class MWLBFactory { $server['port'] = $mainConfig->get( 'DBport' ); // Work around the reserved word usage in MediaWiki schema $server['keywordTableMap'] = [ 'user' => 'mwuser', 'text' => 'pagecontent' ]; + } elseif ( $server['type'] === 'mssql' ) { + $server['port'] = $mainConfig->get( 'DBport' ); + $server['useWindowsAuth'] = $mainConfig->get( 'DBWindowsAuthentication' ); } $lbConf['servers'] = [ $server ]; } @@ -171,6 +184,17 @@ abstract class MWLBFactory { ); } + // For configuration backward compatibility after moving classes to namespaces (1.29) + $compat = [ + 'LBFactorySingle' => Wikimedia\Rdbms\LBFactorySingle::class, + 'LBFactorySimple' => Wikimedia\Rdbms\LBFactorySimple::class, + 'LBFactoryMulti' => Wikimedia\Rdbms\LBFactoryMulti::class + ]; + + if ( isset( $compat[$class] ) ) { + $class = $compat[$class]; + } + return $class; } }