Add checks for proper Postgres version early on.
authorGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 3 Sep 2006 23:03:53 +0000 (23:03 +0000)
committerGreg Sabino Mullane <greg@users.mediawiki.org>
Sun, 3 Sep 2006 23:03:53 +0000 (23:03 +0000)
Add ctype to the tracking table.

RELEASE-NOTES
includes/DatabasePostgres.php
maintenance/postgres/tables.sql

index a9d76f3..2bec957 100644 (file)
@@ -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 ==
index 0dbfd24..8554ce2 100644 (file)
@@ -94,6 +94,19 @@ class DatabasePostgres extends Database {
                                $wgDBts2schema, $wgDBts2locale;
                        print "OK</li>\n";
 
+                       print "<li>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 "<b>FAILED</b> (could not determine the version)</li>\n";
+                               dieout("</ul>");
+                       }
+                       $PGMINVER = "8.1";
+                       if ($thisver[1] < $PGMINVER) {
+                               print "<b>FAILED</b>. Required version is $PGMINVER. You have $thisver[1]$thisver[2]</li>\n";
+                               dieout("</ul>");
+                       }
+                       print "version $thisver[1]$thisver[2] is OK.</li>\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);
 
index 17f51e7..76073bb 100644 (file)
@@ -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,