diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-07-27 19:42:56 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-07-27 19:42:56 +0000 |
commit | 1aec298314454b67fbc18738c3ffa6f12a14dd59 (patch) | |
tree | bd84dbcdf3593e276d6d3c352feff460be716762 /includes/database/pgsql | |
parent | a7e7c0a9e73f71f8de0db084e194647237fab298 (diff) | |
download | brdo-1aec298314454b67fbc18738c3ffa6f12a14dd59.tar.gz brdo-1aec298314454b67fbc18738c3ffa6f12a14dd59.tar.bz2 |
- Patch #349508 by Josh Waihi: make sure that the database is installed using UTF-8 on PostgreSQL.
Diffstat (limited to 'includes/database/pgsql')
-rw-r--r-- | includes/database/pgsql/install.inc | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/includes/database/pgsql/install.inc b/includes/database/pgsql/install.inc index b301cb672..222d7e734 100644 --- a/includes/database/pgsql/install.inc +++ b/includes/database/pgsql/install.inc @@ -9,10 +9,41 @@ // PostgreSQL specific install functions -class DatabaseInstaller_pgsql extends DatabaseInstaller { +class DatabaseTasks_pgsql extends DatabaseTasks { protected $pdoDriver = 'pgsql'; + + public function __construct() { + $this->tasks[] = array( + 'function' => 'checkEncoding', + 'arguments' => array(), + ); + } + public function name() { return 'PostgreSQL'; } + + /** + * Check encoding is UTF8. + */ + protected function checkEncoding() { + try { + if (db_query('SHOW server_encoding')->fetchField() == 'UTF8') { + $this->pass(st('Database is encoded in UTF-8')); + } + else { + $replacements = array( + '%encoding' => 'UTF8', + '%driver' => $this->name(), + '!link' => '<a href="INSTALL.pgsql.txt">INSTALL.pgsql.txt</a>' + ); + $text = 'The %driver database must use %encoding encoding to work with Drupal.'; + $text .= 'Please recreate the database with %encoding encoding. See !link for more details.'; + $this->fail(st($text, $replacements)); + } + } catch (Exception $e) { + $this->fail(st('Drupal could not determine the encoding of the database was set to UTF-8')); + } + } } |