From 59a4eb0971c9cafe2fe1f3158458a4fb84418781 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sun, 16 Jul 2006 15:18:51 +0000 Subject: [PATCH] Add superuser section for Postgres connections. --- config/index.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/config/index.php b/config/index.php index 6626b61d8d..5b34464166 100644 --- a/config/index.php +++ b/config/index.php @@ -681,12 +681,26 @@ error_reporting( E_ALL ); if( !$ok ) { continue; } } else /* not mysql */ { - echo( "
  • Attempting to connect to database server as $wgDBuser..." ); + error_reporting( E_ALL ); + $wgSuperUser = ''; + ## Possible connect as a superuser + if( $conf->RootPW != '-' and strlen($conf->RootPW)) { + $wgDBsuperuser = $conf->RootUser; + echo( "
  • Attempting to connect to database \"postgres\" as superuser \"$wgDBsuperuser\"..." ); + $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBsuperuser, $conf->RootPW, "postgres", 1); + if (!$wgDatabase->isOpen()) { + print " error: " . $wgDatabase->lastError() . "
  • \n"; + $errs["DBserver"] = "Couldn't connect to database as superuser"; + $errs["RootUser"] = "Check username"; + $errs["RootPW"] = "and password"; + continue; + } + } + echo( "
  • Attempting to connect to database \"$wgDBname\" as \"$wgDBuser\"..." ); $wgDatabase = $dbc->newFromParams($wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1); if (!$wgDatabase->isOpen()) { print " error: " . $wgDatabase->lastError() . "
  • \n"; } else { - $wgDatabase->ignoreErrors(true); $myver = $wgDatabase->getServerVersion(); } } @@ -798,7 +812,7 @@ error_reporting( E_ALL ); 'ss_good_articles' => 0 ) ); # Set up the "regular user" account *if we can, and if we need to* - if( $conf->Root ) { + if( $conf->Root and $conf->DBtype == 'mysql') { # See if we need to $wgDatabase2 = $dbc->newFromParams( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname, 1 ); if( $wgDatabase2->isOpen() ) { -- 2.20.1