return 'mysql';
}
- public function __construct( $parent ) {
- parent::__construct( $parent );
- }
-
/**
* @return Bool
*/
public function isCompiled() {
- return self::checkExtension( 'mysql' );
+ return self::checkExtension( 'mysql' ) || self::checkExtension( 'mysqli' );
}
/**
* @return string
*/
public function getConnectForm() {
- return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+ return $this->getTextBox(
+ 'wgDBserver',
+ 'config-db-host',
+ array(),
+ $this->parent->getHelpBox( 'config-db-host-help' )
+ ) .
Html::openElement( 'fieldset' ) .
Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
$this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ),
public function openConnection() {
$status = Status::newGood();
try {
- $db = new DatabaseMysql(
- $this->getVar( 'wgDBserver' ),
- $this->getVar( '_InstallUser' ),
- $this->getVar( '_InstallPassword' ),
- false,
- 0,
- $this->getVar( 'wgDBprefix' )
- );
+ $db = DatabaseBase::factory( 'mysql', array(
+ 'host' => $this->getVar( 'wgDBserver' ),
+ 'user' => $this->getVar( '_InstallUser' ),
+ 'password' => $this->getVar( '_InstallPassword' ),
+ 'dbname' => false,
+ 'flags' => 0,
+ 'tablePrefix' => $this->getVar( 'wgDBprefix' ) ) );
$status->value = $db;
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
if ( !$status->isOK() ) {
return false;
}
- /**
- * @var $conn DatabaseBase
- */
+ /** @var $conn DatabaseBase */
$conn = $status->value;
// Get current account name
if ( !$create ) {
// Test the web account
try {
- new DatabaseMysql(
- $this->getVar( 'wgDBserver' ),
- $this->getVar( 'wgDBuser' ),
- $this->getVar( 'wgDBpassword' ),
- false,
- 0,
- $this->getVar( 'wgDBprefix' )
- );
+ DatabaseBase::factory( 'mysql', array(
+ '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() );
}
if ( !$status->isOK() ) {
return $status;
}
+ /** @var DatabaseBase $conn */
$conn = $status->value;
$dbName = $this->getVar( 'wgDBname' );
if ( !$conn->selectDB( $dbName ) ) {
- $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8", __METHOD__ );
+ $conn->query(
+ "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ) . "CHARACTER SET utf8",
+ __METHOD__
+ );
$conn->selectDB( $dbName );
}
$this->setupSchemaVars();
if ( $this->getVar( '_CreateDBAccount' ) ) {
// Before we blindly try to create a user that already has access,
try { // first attempt to connect to the database
- new DatabaseMysql(
- $server,
- $dbUser,
- $password,
- false,
- 0,
- $this->getVar( 'wgDBprefix' )
- );
+ DatabaseBase::factory( 'mysql', array(
+ 'host' => $server,
+ 'user' => $dbUser,
+ 'password' => $password,
+ 'dbname' => false,
+ 'flags' => 0,
+ 'tablePrefix' => $this->getVar( 'wgDBprefix' )
+ ) );
$grantableNames[] = $this->buildFullUserName( $dbUser, $server );
$tryToCreate = false;
} catch ( DBConnectionError $e ) {