Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getFormOptions(array $database)
 {
     $form = parent::getFormOptions($database);
     if (empty($form['advanced_options']['port']['#default_value'])) {
         $form['advanced_options']['port']['#default_value'] = '3306';
     }
     return $form;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function getFormOptions(array $database)
 {
     $form = parent::getFormOptions($database);
     // Remove the options that only apply to client/server style databases.
     unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
     // Make the text more accurate for SQLite.
     $form['database']['#title'] = t('Database file');
     $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', array('@drupal' => drupal_install_profile_distribution_name()));
     $default_database = \Drupal::service('site.path') . '/files/.ht.sqlite';
     $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
     return $form;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 protected function checkEngineVersion()
 {
     parent::checkEngineVersion();
     // Ensure that the MySQL driver supports utf8mb4 encoding.
     $version = Database::getConnection()->clientVersion();
     if (FALSE !== strpos($version, 'mysqlnd')) {
         // The mysqlnd driver supports utf8mb4 starting at version 5.0.9.
         $version = preg_replace('/^\\D+([\\d.]+).*/', '$1', $version);
         if (version_compare($version, self::MYSQLND_MINIMUM_VERSION, '<')) {
             $this->fail(t("The MySQLnd driver version %version is less than the minimum required version. Upgrade to MySQLnd version %mysqlnd_minimum_version or up, or alternatively switch mysql drivers to libmysqlclient version %libmysqlclient_minimum_version or up.", array('%version' => $version, '%mysqlnd_minimum_version' => self::MYSQLND_MINIMUM_VERSION, '%libmysqlclient_minimum_version' => self::LIBMYSQLCLIENT_MINIMUM_VERSION)));
         }
     } else {
         // The libmysqlclient driver supports utf8mb4 starting at version 5.5.3.
         if (version_compare($version, self::LIBMYSQLCLIENT_MINIMUM_VERSION, '<')) {
             $this->fail(t("The libmysqlclient driver version %version is less than the minimum required version. Upgrade to libmysqlclient version %libmysqlclient_minimum_version or up, or alternatively switch mysql drivers to MySQLnd version %mysqlnd_minimum_version or up.", array('%version' => $version, '%libmysqlclient_minimum_version' => self::LIBMYSQLCLIENT_MINIMUM_VERSION, '%mysqlnd_minimum_version' => self::MYSQLND_MINIMUM_VERSION)));
         }
     }
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function getFormOptions(array $database) {
   $form = parent::getFormOptions($database);
   if (empty($form['advanced_options']['port']['#default_value'])) {
     $form['advanced_options']['port']['#default_value'] = '1433';
   }
   // Make username not required.
   $form['username']['#required'] = FALSE;
   // Add a description for about leaving username blank.
   $form['username']['#description'] = t('Leave username (and password) blank to use Windows authentication.');
   return $form;
 }