From: Greg Sabino Mullane Date: Mon, 26 Mar 2007 00:12:26 +0000 (+0000) Subject: Account for pre-existing test table, commit only if setup completes. X-Git-Tag: 1.31.0-rc.0~53609 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=bca55fa58f85fd58f6159b6bd5586177866203c3;p=lhc%2Fweb%2Fwiklou.git Account for pre-existing test table, commit only if setup completes. --- diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 3fe8144f00..bed25d8547 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -908,7 +908,11 @@ END; ## Make sure that we can write to the correct schema ## If not, Postgres will happily and silently go to the next search_path item - $SQL = "CREATE TABLE $wgDBmwschema.mw_test_table(a int)"; + $ctest = "mw_test_table"; + if ($this->tableExists($ctest, $wgDBmwschema)) { + $this->doQuery("DROP TABLE $wgDBmwschema.$ctest"); + } + $SQL = "CREATE TABLE $wgDBmwschema.$ctest(a int)"; error_reporting( 0 ); $res = $this->doQuery($SQL); error_reporting( E_ALL ); @@ -916,6 +920,7 @@ END; print "FAILED. Make sure that the user \"$wgDBuser\" can write to the schema \"$wgDBmwschema\"\n"; dieout(""); } + $this->doQuery("DROP TABLE $wgDBmwschema.mw_test_table"); dbsource( "../maintenance/postgres/tables.sql", $this); @@ -961,6 +966,8 @@ END; $this->query("$SQL $matches[1],$matches[2])"); } print " (table interwiki successfully populated)...\n"; + + $this->doQuery("COMMIT"); } function encodeBlob($b) { diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index 5eba2cf92d..1c7c42dcb0 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -514,4 +514,3 @@ INSERT INTO mediawiki_version (type,mw_version,sql_version,sql_date) VALUES ('Creation','??','$LastChangedRevision$','$LastChangedDate$'); -COMMIT;