X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2Finstaller%2FDatabaseInstaller.php;h=e6ee70edfd63c8ca47777411f7449c38e2c675a8;hb=ef970021795d220af007fd603e4813c1122bc8ef;hp=6c56b3d430c987ff23f0587aac8a26f58ace775a;hpb=5049af1048c77b1ea6ab3193688d23a48ddf8df0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 6c56b3d430..e6ee70edfd 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'. */ @@ -697,16 +724,16 @@ 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; } global $IP; - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $rows = file( "$IP/maintenance/interwiki.list", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); $interwikis = []; if ( !$rows ) { return Status::newFatal( 'config-install-interwiki-list' );