From: Greg Sabino Mullane Date: Sun, 3 Sep 2006 23:03:53 +0000 (+0000) Subject: Add checks for proper Postgres version early on. X-Git-Tag: 1.31.0-rc.0~55840 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=d63c80199df18b71d8fc3eaaa66d9d0a2c08d30a;p=lhc%2Fweb%2Fwiklou.git Add checks for proper Postgres version early on. Add ctype to the tracking table. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a9d76f3862..2bec957f76 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -33,7 +33,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6420) Render thumbnails for DJVU images, support multipage DJVU display on image pages. Added new 'page=' thumbnail option to select a page from a multipage djvu for thumbnail generation. -* Full Postgres support is now enabled. It requires version 8.0 or better, and +* Full Postgres support is now enabled. It requires version 8.1 or better, and needs to have both plpgsql and tsearch2 already installed. == Changes since 1.7 == diff --git a/includes/DatabasePostgres.php b/includes/DatabasePostgres.php index 0dbfd2473f..8554ce217f 100644 --- a/includes/DatabasePostgres.php +++ b/includes/DatabasePostgres.php @@ -94,6 +94,19 @@ class DatabasePostgres extends Database { $wgDBts2schema, $wgDBts2locale; print "OK\n"; + print "
  • Checking the version of Postgres..."; + $version = pg_fetch_result($this->doQuery("SELECT version()"),0,0); + if (!preg_match("/PostgreSQL (\d+\.\d+)(\S+)/", $version, $thisver)) { + print "FAILED (could not determine the version)
  • \n"; + dieout(""); + } + $PGMINVER = "8.1"; + if ($thisver[1] < $PGMINVER) { + print "FAILED. Required version is $PGMINVER. You have $thisver[1]$thisver[2]\n"; + dieout(""); + } + print "version $thisver[1]$thisver[2] is OK.\n"; + $safeuser = $this->quote_ident($wgDBuser); ## Are we connecting as a superuser for the first time? if ($wgDBsuperuser) { @@ -775,9 +788,11 @@ class DatabasePostgres extends Database { $tss = $this->addQuotes($wgDBts2schema); $pgp = $this->addQuotes($wgDBport); $dbn = $this->addQuotes($this->mDBname); + $ctype = pg_fetch_result($this->doQuery("SHOW lc_ctype"),0,0); $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 ". + "ctype = '$ctype' ". "WHERE type = 'Creation'"; $this->query($SQL); diff --git a/maintenance/postgres/tables.sql b/maintenance/postgres/tables.sql index 17f51e785b..76073bb9a9 100644 --- a/maintenance/postgres/tables.sql +++ b/maintenance/postgres/tables.sql @@ -462,6 +462,7 @@ CREATE TABLE mediawiki_version ( pg_port TEXT NULL, mw_schema TEXT NULL, ts2_schema TEXT NULL, + ctype TEXT NULL, sql_version TEXT NULL, sql_date TEXT NULL,