Skip navigation
Help

install.inc

  1. drupal
    1. 6 drupal/includes/install.inc
    2. 7 drupal/includes/install.inc
    3. 7 drupal/includes/database/mysql/install.inc
    4. 7 drupal/includes/database/sqlite/install.inc
    5. 7 drupal/includes/database/pgsql/install.inc

SQLite specific install functions

Classes

NameDescription
DatabaseTasks_sqlite

File

drupal/includes/database/sqlite/install.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * SQLite specific install functions
  5. */
  6. class DatabaseTasks_sqlite extends DatabaseTasks {
  7. protected $pdoDriver = 'sqlite';
  8. public function name() {
  9. return st('SQLite');
  10. }
  11. /**
  12. * Minimum engine version.
  13. *
  14. * @todo: consider upping to 3.6.8 in Drupal 8 to get SAVEPOINT support.
  15. */
  16. public function minimumVersion() {
  17. return '3.3.7';
  18. }
  19. public function getFormOptions($database) {
  20. $form = parent::getFormOptions($database);
  21. // Remove the options that only apply to client/server style databases.
  22. unset($form['username'], $form['password'], $form['advanced_options']['host'], $form['advanced_options']['port']);
  23. // Make the text more accurate for SQLite.
  24. $form['database']['#title'] = st('Database file');
  25. $form['database']['#description'] = st('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()));
  26. $default_database = conf_path(FALSE, TRUE) . '/files/.ht.sqlite';
  27. $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
  28. return $form;
  29. }
  30. public function validateDatabaseSettings($database) {
  31. // Perform standard validation.
  32. $errors = parent::validateDatabaseSettings($database);
  33. // Verify the database is writable.
  34. $db_directory = new SplFileInfo(dirname($database['database']));
  35. if (!$db_directory->isWritable()) {
  36. $errors[$database['driver'] . '][database'] = st('The directory you specified is not writable by the web server.');
  37. }
  38. return $errors;
  39. }
  40. }