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()
12 ->from( 'information_schema.schemata' )
13 ->where( [ 'schema_name' => $database ] )
14 ->caller( __METHOD__
)
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();