summaryrefslogtreecommitdiff
path: root/install.php
diff options
context:
space:
mode:
Diffstat (limited to 'install.php')
-rw-r--r--install.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/install.php b/install.php
index 1d3a531c5..901e502f1 100644
--- a/install.php
+++ b/install.php
@@ -242,6 +242,20 @@ function pgsql_db_installer($host, $database, $username, $password, $sitename) {
updateStatus("Starting installation...");
updateStatus("Checking database...");
$conn = pg_connect($connstring);
+
+ if ($conn ===false) {
+ updateStatus("Failed to connect to database: $connstring");
+ showForm();
+ return false;
+ }
+
+ //ensure database encoding is UTF8
+ $record = pg_fetch_object(pg_query($conn, 'SHOW server_encoding'));
+ if ($record->server_encoding != 'UTF8') {
+ updateStatus("Laconica requires UTF8 character encoding. Your database is ". htmlentities($record->server_encoding));
+ showForm();
+ return false;
+ }
updateStatus("Running database script...");
//wrap in transaction;