X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Finstaller%2FDatabaseInstaller.php;h=62acebf3820efc7af0faa586f96dacf02fa10068;hp=61135736bdedf9d3eb10b40812354cb2c88bcbe0;hb=f73f2b320d8fe1eb03f78671584d455a2ff9f292;hpb=ca55cfd87d2efc41b6ab208d60d1cde61f0ac9c0 diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 61135736bd..62acebf382 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -41,6 +41,16 @@ abstract class DatabaseInstaller { */ public $parent; + /** + * @var string Set by subclasses + */ + public static $minimumVersion; + + /** + * @var string Set by subclasses + */ + protected static $notMiniumumVerisonMessage; + /** * The database connection. * @@ -62,6 +72,23 @@ abstract class DatabaseInstaller { */ protected $globalNames = []; + /** + * Whether the provided version meets the necessary requirements for this type + * + * @param string $serverVersion Output of Database::getServerVersion() + * @return Status + * @since 1.30 + */ + public static function meetsMinimumRequirement( $serverVersion ) { + if ( version_compare( $serverVersion, static::$minimumVersion ) < 0 ) { + return Status::newFatal( + static::$notMiniumumVerisonMessage, static::$minimumVersion, $serverVersion + ); + } + + return Status::newGood(); + } + /** * Return the internal name, e.g. 'mysql', or 'sqlite'. */ @@ -336,7 +363,7 @@ abstract class DatabaseInstaller { $services = \MediaWiki\MediaWikiServices::getInstance(); $connection = $status->value; - $services->redefineService( 'DBLoadBalancerFactory', function() use ( $connection ) { + $services->redefineService( 'DBLoadBalancerFactory', function () use ( $connection ) { return LBFactorySingle::newFromConnection( $connection ); } ); } @@ -697,7 +724,7 @@ abstract class DatabaseInstaller { } $this->db->selectDB( $this->getVar( 'wgDBname' ) ); - if ( $this->db->selectRow( 'interwiki', '*', [], __METHOD__ ) ) { + if ( $this->db->selectRow( 'interwiki', '1', [], __METHOD__ ) ) { $status->warning( 'config-install-interwiki-exists' ); return $status;