function submitConnectForm() {
// Get variables from the request
- $newValues = $this->setVarsFromRequest( array(
- 'wgDBserver', 'wgDBport', 'wgDBname', 'wgDBmwschema',
- '_InstallUser', '_InstallPassword'
- ) );
+ $newValues = $this->setVarsFromRequest( array( 'wgDBserver', 'wgDBport', 'wgDBname', 'wgDBmwschema' ) );
// Validate them
$status = Status::newGood();
if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
$status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
}
- if ( !strlen( $newValues['_InstallUser'] ) ) {
- $status->fatal( 'config-db-username-empty' );
- }
- if ( !strlen( $newValues['_InstallPassword'] ) ) {
- $status->fatal( 'config-db-password-empty', $newValues['_InstallUser'] );
- }
// Submit user box
if ( $status->isOK() ) {
$status = Status::newGood();
foreach ( $dbs as $db ) {
try {
- $conn = $this->openConnectionWithParams(
- $user,
- $password,
- $db,
- $this->getVar( 'wgDBmwschema' ) );
+ $p = array(
+ 'host' => $this->getVar( 'wgDBserver' ),
+ 'user' => $user,
+ 'password' => $password,
+ 'dbname' => $db
+ );
+ $conn = DatabaseBase::factory( 'postgres', $p );
} catch ( DBConnectionError $error ) {
$conn = false;
$status->fatal( 'config-pg-test-error', $db,
public function getGlobalDefaults() {
// The default $wgDBmwschema is null, which breaks Postgres and other DBMSes that require
// the use of a schema, so we need to set it here
- return array(
+ return array_merge( parent::getGlobalDefaults(), array(
'wgDBmwschema' => 'mediawiki',
- );
+ ) );
}
public function setupPLpgSQL() {