Merge ".mailmap: Correct two contributor names"
[mediawiki.git] / includes / installer / MysqlDatabaseCreator.php
blob855cf028f435f0fbc5e83f9a91d079ecca9c3aa9
1 <?php
3 namespace MediaWiki\Installer;
5 use MediaWiki\Status\Status;
6 use Wikimedia\Rdbms\IDatabase;
8 class MysqlDatabaseCreator extends NetworkedDatabaseCreator {
9 protected function existsInConnection( IDatabase $conn, $database ) {
10 return (bool)$conn->newSelectQueryBuilder()
11 ->select( '1' )
12 ->from( 'information_schema.schemata' )
13 ->where( [ 'schema_name' => $database ] )
14 ->caller( __METHOD__ )
15 ->fetchRow();
18 protected function createInConnection( IDatabase $conn, $database ): Status {
19 $encDatabase = $conn->addIdentifierQuotes( $database );
20 $conn->query( "CREATE DATABASE IF NOT EXISTS $encDatabase", __METHOD__ );
21 return Status::newGood();