You are here

protected function Tasks::checkEncoding in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php \Drupal\Core\Database\Driver\pgsql\Install\Tasks::checkEncoding()

Check encoding is UTF8.

File

core/lib/Drupal/Core/Database/Driver/pgsql/Install/Tasks.php, line 119
Contains \Drupal\Core\Database\Driver\pgsql\Install\Tasks.

Class

Tasks
Specifies installation tasks for PostgreSQL databases.

Namespace

Drupal\Core\Database\Driver\pgsql\Install

Code

protected function checkEncoding() {
  try {
    if (db_query('SHOW server_encoding')
      ->fetchField() == 'UTF8') {
      $this
        ->pass(t('Database is encoded in UTF-8'));
    }
    else {
      $this
        ->fail(t('The %driver database must use %encoding encoding to work with Drupal. Recreate the database with %encoding encoding. See <a href="INSTALL.pgsql.txt">INSTALL.pgsql.txt</a> for more details.', array(
        '%encoding' => 'UTF8',
        '%driver' => $this
          ->name(),
      )));
    }
  } catch (\Exception $e) {
    $this
      ->fail(t('Drupal could not determine the encoding of the database was set to UTF-8'));
  }
}