Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -137,15 +137,11 @@ |
138 | 138 | array( 'usename' => $superuser ), __METHOD__ |
139 | 139 | ); |
140 | 140 | |
141 | | - if( !$rights ) { |
142 | | - return false; |
| 141 | + if( !$rights || ( $rights != 1 && $rights != 3 ) ) { |
| 142 | + $status = Status::newFatal("can't create"); |
143 | 143 | } |
144 | 144 | |
145 | | - if( $rights != 1 && $rights != 3 ) { |
146 | | - return false; |
147 | | - } |
148 | | - |
149 | | - return true; |
| 145 | + return $status; |
150 | 146 | } |
151 | 147 | |
152 | 148 | public function getSettingsForm() { |
— | — | @@ -166,26 +162,21 @@ |
167 | 163 | } |
168 | 164 | |
169 | 165 | // Validate the create checkbox |
| 166 | + $create = true; |
170 | 167 | $canCreate = $this->canCreateAccounts(); |
171 | | - if ( !$canCreate ) { |
| 168 | + if ( !$canCreate->isOK() ) { |
172 | 169 | $this->setVar( '_CreateDBAccount', false ); |
173 | 170 | $create = false; |
174 | 171 | } else { |
175 | 172 | $create = $this->getVar( '_CreateDBAccount' ); |
176 | 173 | } |
177 | 174 | |
178 | | - if ( !$create ) { |
| 175 | + // Don't test the web account if it is the same as the admin. |
| 176 | + if ( !$create && $this->getVar( 'wgDBuser' ) != $this->getVar( '_InstallUser' ) ) { |
179 | 177 | // Test the web account |
180 | 178 | try { |
181 | | - new DatabasePostgres( |
182 | | - $this->getVar( 'wgDBserver' ), |
183 | | - $this->getVar( 'wgDBuser' ), |
184 | | - $this->getVar( 'wgDBpassword' ), |
185 | | - false, |
186 | | - false, |
187 | | - 0, |
188 | | - $this->getVar( 'wgDBprefix' ) |
189 | | - ); |
| 179 | + $this->useAdmin = FALSE; |
| 180 | + return $this->openConnection(); |
190 | 181 | } catch ( DBConnectionError $e ) { |
191 | 182 | return Status::newFatal( 'config-connection-error', $e->getMessage() ); |
192 | 183 | } |