'_MysqlEngine' => 'InnoDB',
'_MysqlCharset' => 'binary',
'_InstallUser' => 'root',
'_MysqlEngine' => 'InnoDB',
'_MysqlCharset' => 'binary',
'_InstallUser' => 'root',
- Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
- $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ),
+ Html::element( 'legend', [], wfMessage( 'config-db-wiki-settings' )->text() ) .
+ $this->getTextBox( 'wgDBname', 'config-db-name', [ 'dir' => 'ltr' ],
- $this->getTextBox( 'wgDBprefix', 'config-db-prefix', array( 'dir' => 'ltr' ),
+ $this->getTextBox( 'wgDBprefix', 'config-db-prefix', [ 'dir' => 'ltr' ],
$this->parent->getHelpBox( 'config-db-prefix-help' ) ) .
Html::closeElement( 'fieldset' ) .
$this->getInstallUserBox();
$this->parent->getHelpBox( 'config-db-prefix-help' ) ) .
Html::closeElement( 'fieldset' ) .
$this->getInstallUserBox();
'host' => $this->getVar( 'wgDBserver' ),
'user' => $this->getVar( '_InstallUser' ),
'password' => $this->getVar( '_InstallPassword' ),
'dbname' => false,
'flags' => 0,
'host' => $this->getVar( 'wgDBserver' ),
'user' => $this->getVar( '_InstallUser' ),
'password' => $this->getVar( '_InstallPassword' ),
'dbname' => false,
'flags' => 0,
$status->value = $db;
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
$status->value = $db;
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
$res = $conn->query( 'SHOW ENGINES', __METHOD__ );
foreach ( $res as $row ) {
if ( $row->Support == 'YES' || $row->Support == 'DEFAULT' ) {
$res = $conn->query( 'SHOW ENGINES', __METHOD__ );
foreach ( $res as $row ) {
if ( $row->Support == 'YES' || $row->Support == 'DEFAULT' ) {
// The user needs to have INSERT on mysql.* to be able to CREATE USER
// The grantee will be double-quoted in this query, as required
$res = $conn->select( 'INFORMATION_SCHEMA.USER_PRIVILEGES', '*',
// The user needs to have INSERT on mysql.* to be able to CREATE USER
// The grantee will be double-quoted in this query, as required
$res = $conn->select( 'INFORMATION_SCHEMA.USER_PRIVILEGES', '*',
// Check for DB-specific privs for mysql.*
if ( !$insertMysql ) {
$row = $conn->selectRow( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
// Check for DB-specific privs for mysql.*
if ( !$insertMysql ) {
$row = $conn->selectRow( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
'GRANTEE' => $quotedUser,
'TABLE_SCHEMA' => 'mysql',
'PRIVILEGE_TYPE' => 'INSERT',
'GRANTEE' => $quotedUser,
'TABLE_SCHEMA' => 'mysql',
'PRIVILEGE_TYPE' => 'INSERT',
// Check for DB-level grant options
$res = $conn->select( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
// Check for DB-level grant options
$res = $conn->select( 'INFORMATION_SCHEMA.SCHEMA_PRIVILEGES', '*',
foreach ( $res as $row ) {
$regex = $conn->likeToRegex( $row->TABLE_SCHEMA );
if ( preg_match( $regex, $this->getVar( 'wgDBname' ) ) ) {
foreach ( $res as $row ) {
$regex = $conn->likeToRegex( $row->TABLE_SCHEMA );
if ( preg_match( $regex, $this->getVar( 'wgDBname' ) ) ) {
$myisamWarning = 'config-mysql-myisam-dep';
if ( count( $engines ) === 1 ) {
$myisamWarning = 'config-mysql-only-myisam-dep';
$myisamWarning = 'config-mysql-myisam-dep';
if ( count( $engines ) === 1 ) {
$myisamWarning = 'config-mysql-only-myisam-dep';
// getRadioSet() builds a set of labeled radio buttons.
// For grep: The following messages are used as the item labels:
// config-mysql-innodb, config-mysql-myisam
// getRadioSet() builds a set of labeled radio buttons.
// For grep: The following messages are used as the item labels:
// config-mysql-innodb, config-mysql-myisam
'var' => '_MysqlEngine',
'label' => 'config-mysql-engine',
'itemLabelPrefix' => 'config-mysql-',
'values' => $engines,
'var' => '_MysqlEngine',
'label' => 'config-mysql-engine',
'itemLabelPrefix' => 'config-mysql-',
'values' => $engines,
'class' => 'showHideRadio',
'rel' => 'dbMyisamWarning'
'class' => 'showHideRadio',
'rel' => 'dbMyisamWarning'
'class' => 'hideShowRadio',
'rel' => 'dbMyisamWarning'
'class' => 'hideShowRadio',
'rel' => 'dbMyisamWarning'
// getRadioSet() builds a set of labeled radio buttons.
// For grep: The following messages are used as the item labels:
// config-mysql-binary, config-mysql-utf8
// getRadioSet() builds a set of labeled radio buttons.
// For grep: The following messages are used as the item labels:
// config-mysql-binary, config-mysql-utf8
'var' => '_MysqlCharset',
'label' => 'config-mysql-charset',
'itemLabelPrefix' => 'config-mysql-',
'values' => $charsets
'var' => '_MysqlCharset',
'label' => 'config-mysql-charset',
'itemLabelPrefix' => 'config-mysql-',
'values' => $charsets
'host' => $this->getVar( 'wgDBserver' ),
'user' => $this->getVar( 'wgDBuser' ),
'password' => $this->getVar( 'wgDBpassword' ),
'dbname' => false,
'flags' => 0,
'tablePrefix' => $this->getVar( 'wgDBprefix' )
'host' => $this->getVar( 'wgDBserver' ),
'user' => $this->getVar( 'wgDBuser' ),
'password' => $this->getVar( 'wgDBpassword' ),
'dbname' => false,
'flags' => 0,
'tablePrefix' => $this->getVar( 'wgDBprefix' )
} catch ( DBConnectionError $e ) {
return Status::newFatal( 'config-connection-error', $e->getMessage() );
}
} catch ( DBConnectionError $e ) {
return Status::newFatal( 'config-connection-error', $e->getMessage() );
}
public function preInstall() {
# Add our user callback to installSteps, right before the tables are created.
public function preInstall() {
# Add our user callback to installSteps, right before the tables are created.
$this->db->selectDB( $dbName );
$server = $this->getVar( 'wgDBserver' );
$password = $this->getVar( 'wgDBpassword' );
$this->db->selectDB( $dbName );
$server = $this->getVar( 'wgDBserver' );
$password = $this->getVar( 'wgDBpassword' );
if ( $this->getVar( '_CreateDBAccount' ) ) {
// Before we blindly try to create a user that already has access,
try { // first attempt to connect to the database
if ( $this->getVar( '_CreateDBAccount' ) ) {
// Before we blindly try to create a user that already has access,
try { // first attempt to connect to the database
$grantableNames[] = $this->buildFullUserName( $dbUser, $server );
$tryToCreate = false;
} catch ( DBConnectionError $e ) {
$grantableNames[] = $this->buildFullUserName( $dbUser, $server );
$tryToCreate = false;
} catch ( DBConnectionError $e ) {
$createHostList = array_unique( $createHostList );
$escPass = $this->db->addQuotes( $password );
foreach ( $createHostList as $host ) {
$fullName = $this->buildFullUserName( $dbUser, $host );
$createHostList = array_unique( $createHostList );
$escPass = $this->db->addQuotes( $password );
foreach ( $createHostList as $host ) {
$fullName = $this->buildFullUserName( $dbUser, $host );
try {
$this->db->begin( __METHOD__ );
$this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
try {
$this->db->begin( __METHOD__ );
$this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
- $res = $this->db->selectRow( 'mysql.user', array( 'Host', 'User' ),
- array( 'Host' => $host, 'User' => $user ), __METHOD__ );
+ $res = $this->db->selectRow( 'mysql.user', [ 'Host', 'User' ],
+ [ 'Host' => $host, 'User' => $user ], __METHOD__ );
if ( $this->getVar( '_MysqlEngine' ) !== null ) {
$options[] = "ENGINE=" . $this->getVar( '_MysqlEngine' );
}
if ( $this->getVar( '_MysqlEngine' ) !== null ) {
$options[] = "ENGINE=" . $this->getVar( '_MysqlEngine' );
}
'wgDBTableOptions' => $this->getTableOptions(),
'wgDBname' => $this->getVar( 'wgDBname' ),
'wgDBuser' => $this->getVar( 'wgDBuser' ),
'wgDBpassword' => $this->getVar( 'wgDBpassword' ),
'wgDBTableOptions' => $this->getTableOptions(),
'wgDBname' => $this->getVar( 'wgDBname' ),
'wgDBuser' => $this->getVar( 'wgDBuser' ),
'wgDBpassword' => $this->getVar( 'wgDBpassword' ),