From ba3459be01574e1619a491a2b3307cb77c6aa1f8 Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Sun, 16 Jul 2006 12:28:38 +0000 Subject: [PATCH] Remove update_interwiki(), add setup_database() --- includes/DatabasePostgres.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 5897386fc6..658828d74b 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -62,7 +62,6 @@ class DatabasePostgres extends Database { $this->mDBname = $dbName; $success = false; - $hstring=""; if ($server!=false && $server!="") { $hstring="host=$server "; @@ -72,7 +71,6 @@ class DatabasePostgres extends Database { } error_reporting( E_ALL ); - @$this->mConn = pg_connect("$hstring dbname=$dbName user=$user password=$password"); if ( $this->mConn == false ) { @@ -104,7 +102,6 @@ class DatabasePostgres extends Database { $rows = $this->numRows($this->doQuery($SQL)); if ($rows < 1) { print "FAILED. Make sure the language plpgsql is installed for the database $wgDBnamet"; - ## XXX Better help dieout(""); } print "OK\n"; @@ -124,7 +121,7 @@ class DatabasePostgres extends Database { print "
  • Schema $wgDBmwschema exists but is not owned by $user. Not ideal.
  • \n"; } else { - print "
  • Schema $wgDBmwschema exists and is owned by $user ($result). Excellent.
  • \n"; + print "
  • Schema $wgDBmwschema exists and is owned by $user. Excellent.
  • \n"; } ## Fix up the search paths if needed @@ -563,9 +560,26 @@ class DatabasePostgres extends Database { return $sql; } - function update_interwiki() { + function setup_database() { + global $wgVersion, $wgDBmwschema, $wgDBts2schema, $wgDBport; + + dbsource( "../maintenance/postgres/tables.sql", $this); + + ## Update version information + $mwv = $this->addQuotes($wgVersion); + $pgv = $this->addQuotes($this->getServerVersion()); + $pgu = $this->addQuotes($this->mUser); + $mws = $this->addQuotes($wgDBmwschema); + $tss = $this->addQuotes($wgDBts2schema); + $pgp = $this->addQuotes($wgDBport); + $dbn = $this->addQuotes($this->mDBname); + + $SQL = "UPDATE mediawiki_version SET mw_version=$mwv, pg_version=$pgv, pg_user=$pgu, ". + "mw_schema = $mws, ts2_schema = $tss, pg_port=$pgp, pg_dbname=$dbn ". + "WHERE type = 'Creation'"; + $this->query($SQL); + ## Avoid the non-standard "REPLACE INTO" syntax - ## Called by config/index.php $f = fopen( "../maintenance/interwiki.sql", 'r' ); if ($f == false ) { dieout( "
  • Could not find the interwiki.sql file"); -- 2.20.1