Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -227,9 +227,9 @@ |
228 | 228 | } |
229 | 229 | |
230 | 230 | |
231 | | - function initial_setup($password, $dbName) { |
| 231 | + function initial_setup($superuser, $password, $dbName) { |
232 | 232 | // If this is the initial connection, setup the schema stuff and possibly create the user |
233 | | - global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBsuperuser, $wgDBmwschema, $wgDBts2schema; |
| 233 | + global $wgDBname, $wgDBuser, $wgDBpassword, $superuser, $wgDBmwschema, $wgDBts2schema; |
234 | 234 | |
235 | 235 | print "<li>Checking the version of Postgres..."; |
236 | 236 | $version = $this->getServerVersion(); |
— | — | @@ -242,17 +242,17 @@ |
243 | 243 | |
244 | 244 | $safeuser = $this->quote_ident($wgDBuser); |
245 | 245 | // Are we connecting as a superuser for the first time? |
246 | | - if ($wgDBsuperuser) { |
| 246 | + if ($superuser) { |
247 | 247 | // Are we really a superuser? Check out our rights |
248 | 248 | $SQL = "SELECT |
249 | 249 | CASE WHEN usesuper IS TRUE THEN |
250 | 250 | CASE WHEN usecreatedb IS TRUE THEN 3 ELSE 1 END |
251 | 251 | ELSE CASE WHEN usecreatedb IS TRUE THEN 2 ELSE 0 END |
252 | 252 | END AS rights |
253 | | - FROM pg_catalog.pg_user WHERE usename = " . $this->addQuotes($wgDBsuperuser); |
| 253 | + FROM pg_catalog.pg_user WHERE usename = " . $this->addQuotes($superuser); |
254 | 254 | $rows = $this->numRows($res = $this->doQuery($SQL)); |
255 | 255 | if (!$rows) { |
256 | | - print "<li>ERROR: Could not read permissions for user \"" . htmlspecialchars( $wgDBsuperuser ) . "\"</li>\n"; |
| 256 | + print "<li>ERROR: Could not read permissions for user \"" . htmlspecialchars( $superuser ) . "\"</li>\n"; |
257 | 257 | dieout('</ul>'); |
258 | 258 | } |
259 | 259 | $perms = pg_fetch_result($res, 0, 0); |
— | — | @@ -264,7 +264,7 @@ |
265 | 265 | } |
266 | 266 | else { |
267 | 267 | if ($perms != 1 and $perms != 3) { |
268 | | - print "<li>ERROR: the user \"" . htmlspecialchars( $wgDBsuperuser ) . "\" cannot create other users. "; |
| 268 | + print "<li>ERROR: the user \"" . htmlspecialchars( $superuser ) . "\" cannot create other users. "; |
269 | 269 | print 'Please use a different Postgres user.</li>'; |
270 | 270 | dieout('</ul>'); |
271 | 271 | } |
— | — | @@ -283,7 +283,7 @@ |
284 | 284 | } |
285 | 285 | else { |
286 | 286 | if ($perms < 1) { |
287 | | - print "<li>ERROR: the user \"" . htmlspecialchars( $wgDBsuperuser ) . "\" cannot create databases. "; |
| 287 | + print "<li>ERROR: the user \"" . htmlspecialchars( $superuser ) . "\" cannot create databases. "; |
288 | 288 | print 'Please use a different Postgres user.</li>'; |
289 | 289 | dieout('</ul>'); |
290 | 290 | } |
— | — | @@ -297,7 +297,7 @@ |
298 | 298 | |
299 | 299 | // Reconnect to check out tsearch2 rights for this user |
300 | 300 | print "<li>Connecting to \"" . htmlspecialchars( $wgDBname ) . "\" as superuser \"" . |
301 | | - htmlspecialchars( $wgDBsuperuser ) . "\" to check rights..."; |
| 301 | + htmlspecialchars( $superuser ) . "\" to check rights..."; |
302 | 302 | |
303 | 303 | $connectVars = array(); |
304 | 304 | if ($this->mServer!=false && $this->mServer!="") { |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | $connectVars['port'] = $this->mPort; |
309 | 309 | } |
310 | 310 | $connectVars['dbname'] = $wgDBname; |
311 | | - $connectVars['user'] = $wgDBsuperuser; |
| 311 | + $connectVars['user'] = $superuser; |
312 | 312 | $connectVars['password'] = $password; |
313 | 313 | |
314 | 314 | @$this->mConn = pg_connect( $this->makeConnectionString( $connectVars ) ); |
— | — | @@ -380,7 +380,7 @@ |
381 | 381 | // Install plpgsql if needed |
382 | 382 | $this->setup_plpgsql(); |
383 | 383 | |
384 | | - $wgDBsuperuser = ''; |
| 384 | + $superuser = ''; |
385 | 385 | return true; // Reconnect as regular user |
386 | 386 | |
387 | 387 | } // end superuser |
Index: trunk/phase3/config/Installer.php |
— | — | @@ -1033,10 +1033,9 @@ |
1034 | 1034 | ## Possible connect as a superuser |
1035 | 1035 | // Changed !mysql to postgres check since it seems to only apply to postgres |
1036 | 1036 | if( $useRoot && $conf->DBtype == 'postgres' ) { |
1037 | | - $wgDBsuperuser = $conf->RootUser; |
1038 | 1037 | echo( "<li>Attempting to connect to database \"postgres\" as superuser \"" . |
1039 | | - htmlspecialchars( $wgDBsuperuser ) . "\"..." ); |
1040 | | - $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1); |
| 1038 | + htmlspecialchars( $conf->RootUser ) . "\"..." ); |
| 1039 | + $wgDatabase = $dbc->newFromParams($wgDBserver, $conf->RootUser, $conf->RootPW, "postgres", 1); |
1041 | 1040 | if (!$wgDatabase->isOpen()) { |
1042 | 1041 | print " error: " . htmlspecialchars( $wgDatabase->lastError() ) . "</li>\n"; |
1043 | 1042 | $errs["DBserver"] = "Could not connect to database as superuser"; |
— | — | @@ -1044,7 +1043,7 @@ |
1045 | 1044 | $errs["RootPW"] = "and password"; |
1046 | 1045 | continue; |
1047 | 1046 | } |
1048 | | - $wgDatabase->initial_setup($conf->RootPW, 'postgres'); |
| 1047 | + $wgDatabase->initial_setup($conf->RootUser, $conf->RootPW, 'postgres'); |
1049 | 1048 | } |
1050 | 1049 | echo( "<li>Attempting to connect to database \"" . htmlspecialchars( $wgDBname ) . |
1051 | 1050 | "\" as \"" . htmlspecialchars( $wgDBuser ) . "\"..." ); |