array( 'usename' => $superuser ), __METHOD__
);
- if( !$rights ) {
- return false;
- }
-
- if( $rights != 1 && $rights != 3 ) {
- return false;
+ if( !$rights || ( $rights != 1 && $rights != 3 ) ) {
+ $status = Status::newFatal("can't create");
}
- return true;
+ return $status;
}
public function getSettingsForm() {
}
// Validate the create checkbox
+ $create = true;
$canCreate = $this->canCreateAccounts();
- if ( !$canCreate ) {
+ if ( !$canCreate->isOK() ) {
$this->setVar( '_CreateDBAccount', false );
$create = false;
} else {
$create = $this->getVar( '_CreateDBAccount' );
}
- if ( !$create ) {
+ // Don't test the web account if it is the same as the admin.
+ if ( !$create && $this->getVar( 'wgDBuser' ) != $this->getVar( '_InstallUser' ) ) {
// Test the web account
try {
- new DatabasePostgres(
- $this->getVar( 'wgDBserver' ),
- $this->getVar( 'wgDBuser' ),
- $this->getVar( 'wgDBpassword' ),
- false,
- false,
- 0,
- $this->getVar( 'wgDBprefix' )
- );
+ $this->useAdmin = FALSE;
+ return $this->openConnection();
} catch ( DBConnectionError $e ) {
return Status::newFatal( 'config-connection-error', $e->getMessage() );
}