$this->getVar( '_InstallUser' ),
$this->getVar( '_InstallPassword' ),
false,
- false,
0,
$this->getVar( 'wgDBprefix' )
);
$s .= Xml::openElement( 'div', array(
'id' => 'dbMyisamWarning'
));
- $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() );
+ $myisamWarning = 'config-mysql-myisam-dep';
+ if ( count( $engines ) === 1 ) {
+ $myisamWarning = 'config-mysql-only-myisam-dep';
+ }
+ $s .= $this->parent->getWarningBox( wfMessage( $myisamWarning )->text() );
$s .= Xml::closeElement( 'div' );
- if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
+ if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
$s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) );
$s .= '$(\'#dbMyisamWarning\').hide();';
$s .= Xml::closeElement( 'script' );
'itemAttribs' => array(
'MyISAM' => array(
'class' => 'showHideRadio',
- 'rel' => 'dbMyisamWarning'),
+ 'rel' => 'dbMyisamWarning'
+ ),
'InnoDB' => array(
'class' => 'hideShowRadio',
- 'rel' => 'dbMyisamWarning')
+ 'rel' => 'dbMyisamWarning'
+ )
)));
$s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
}
$this->getVar( 'wgDBuser' ),
$this->getVar( 'wgDBpassword' ),
false,
- false,
0,
$this->getVar( 'wgDBprefix' )
);
}
$conn = $status->value;
$dbName = $this->getVar( 'wgDBname' );
- if( !$conn->selectDB( $dbName ) ) {
+ if ( !$conn->selectDB( $dbName ) ) {
$conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
$conn->selectDB( $dbName );
}
*/
public function setupUser() {
$dbUser = $this->getVar( 'wgDBuser' );
- if( $dbUser == $this->getVar( '_InstallUser' ) ) {
+ if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
return Status::newGood();
}
$status = $this->getConnection();
$dbUser,
$password,
false,
- false,
0,
$this->getVar( 'wgDBprefix' )
);
$tryToCreate = false;
}
- if( $tryToCreate ) {
+ if ( $tryToCreate ) {
$createHostList = array(
$server,
'localhost',
$createHostList = array_unique( $createHostList );
$escPass = $this->db->addQuotes( $password );
- foreach( $createHostList as $host ) {
+ foreach ( $createHostList as $host ) {
$fullName = $this->buildFullUserName( $dbUser, $host );
- if( !$this->userDefinitelyExists( $dbUser, $host ) ) {
- try{
+ if ( !$this->userDefinitelyExists( $dbUser, $host ) ) {
+ try {
$this->db->begin( __METHOD__ );
$this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
$this->db->commit( __METHOD__ );
$grantableNames[] = $fullName;
- } catch( DBQueryError $dqe ) {
- if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
+ } catch ( DBQueryError $dqe ) {
+ if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
// User (probably) already exists
$this->db->rollback( __METHOD__ );
$status->warning( 'config-install-user-alreadyexists', $dbUser );
// Try to grant to all the users we know exist or we were able to create
$dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
- foreach( $grantableNames as $name ) {
+ foreach ( $grantableNames as $name ) {
try {
$this->db->begin( __METHOD__ );
$this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
$this->db->commit( __METHOD__ );
- } catch( DBQueryError $dqe ) {
+ } catch ( DBQueryError $dqe ) {
$this->db->rollback( __METHOD__ );
$status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
}
$res = $this->db->selectRow( 'mysql.user', array( 'Host', 'User' ),
array( 'Host' => $host, 'User' => $user ), __METHOD__ );
return (bool)$res;
- } catch( DBQueryError $dqe ) {
+ } catch ( DBQueryError $dqe ) {
return false;
}