X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fdb%2FMWLBFactory.php;h=b4e782b62f524a0b9a93e43278b175a5deb714c7;hp=18030090dfd2140e37f1360f8e3876deb2bd1ab6;hb=88e3a888cc6823f11df79ac53eb963a7e4d2871a;hpb=529fc12d2ad2032337594389448fdb5b55802830 diff --git a/includes/db/MWLBFactory.php b/includes/db/MWLBFactory.php index 18030090df..b4e782b62f 100644 --- a/includes/db/MWLBFactory.php +++ b/includes/db/MWLBFactory.php @@ -23,7 +23,6 @@ use MediaWiki\Config\ServiceOptions; use MediaWiki\Logger\LoggerFactory; -use Wikimedia\Rdbms\LBFactory; use Wikimedia\Rdbms\DatabaseDomain; /** @@ -36,12 +35,10 @@ abstract class MWLBFactory { private static $loggedDeprecations = []; /** - * TODO Make this a const when HHVM support is dropped (T192166) - * * @var array * @since 1.34 */ - public static $applyDefaultConfigOptions = [ + public const APPLY_DEFAULT_CONFIG_OPTIONS = [ 'DBcompress', 'DBDefaultGroup', 'DBmwschema', @@ -80,7 +77,7 @@ abstract class MWLBFactory { BagOStuff $mainStash, WANObjectCache $wanCache ) { - $options->assertRequiredOptions( self::$applyDefaultConfigOptions ); + $options->assertRequiredOptions( self::APPLY_DEFAULT_CONFIG_OPTIONS ); global $wgCommandLineMode; @@ -199,13 +196,14 @@ abstract class MWLBFactory { $server += [ 'schema' => $options->get( 'DBmwschema' ) ]; } - $flags = DBO_DEFAULT; - $flags |= $options->get( 'DebugDumpSql' ) ? DBO_DEBUG : 0; - $flags |= $options->get( 'DebugLogFile' ) ? DBO_DEBUG : 0; + $flags = $server['flags'] ?? DBO_DEFAULT; + if ( $options->get( 'DebugDumpSql' ) || $options->get( 'DebugLogFile' ) ) { + $flags |= DBO_DEBUG; + } + $server['flags'] = $flags; $server += [ 'tablePrefix' => $options->get( 'DBprefix' ), - 'flags' => $flags, 'sqlMode' => $options->get( 'SQLMode' ), ]; @@ -359,35 +357,6 @@ abstract class MWLBFactory { return $class; } - /** - * @param LBFactory $lbFactory - * @param string $dbType 'mysql', 'sqlite', etc. - * @internal For use with service wiring - */ - public static function setSchemaAliases( LBFactory $lbFactory, $dbType ) { - if ( $dbType === 'mysql' ) { - /** - * When SQLite indexes were introduced in r45764, it was noted that - * SQLite requires index names to be unique within the whole database, - * not just within a schema. As discussed in CR r45819, to avoid the - * need for a schema change on existing installations, the indexes - * were implicitly mapped from the new names to the old names. - * - * This mapping can be removed if DB patches are introduced to alter - * the relevant tables in existing installations. Note that because - * this index mapping applies to table creation, even new installations - * of MySQL have the old names (except for installations created during - * a period where this mapping was inappropriately removed, see - * T154872). - */ - $lbFactory->setIndexAliases( [ - 'ar_usertext_timestamp' => 'usertext_timestamp', - 'un_user_id' => 'user_id', - 'un_user_ip' => 'user_ip', - ] ); - } - } - /** * Log a database deprecation warning * @param string $msg Deprecation message