You are here

class DatabaseTasks_sqlite in Drupal 7

@file SQLite specific install functions

Hierarchy

Expanded class hierarchy of DatabaseTasks_sqlite

File

includes/database/sqlite/install.inc, line 8
SQLite specific install functions

View source
class DatabaseTasks_sqlite extends DatabaseTasks {
  protected $pdoDriver = 'sqlite';
  public function name() {
    return st('SQLite');
  }

  /**
   * Minimum engine version.
   */
  public function minimumVersion() {
    return '3.3.7';
  }
  public function getFormOptions($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'] = st('Database file');
    $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(),
    ));
    $default_database = conf_path(FALSE, TRUE) . '/files/.ht.sqlite';
    $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
    return $form;
  }
  public function validateDatabaseSettings($database) {

    // Perform standard validation.
    $errors = parent::validateDatabaseSettings($database);

    // Verify the database is writable.
    $db_directory = new SplFileInfo(dirname($database['database']));
    if (!$db_directory
      ->isWritable()) {
      $errors[$database['driver'] . '][database'] = st('The directory you specified is not writable by the web server.');
    }
    return $errors;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DatabaseTasks::$results protected property Results from tasks.
DatabaseTasks::$tasks protected property Structure that describes each task to run.
DatabaseTasks::checkEngineVersion protected function Check the engine version.
DatabaseTasks::connect protected function Check if we can connect to the database.
DatabaseTasks::fail protected function Assert test as failed.
DatabaseTasks::hasPdoDriver protected function Ensure the PDO driver is supported by the version of PHP in use.
DatabaseTasks::installable public function Check whether Drupal is installable on the database.
DatabaseTasks::pass protected function Assert test as a pass.
DatabaseTasks::runTasks public function Run database tasks and tests to see if Drupal can run on the database.
DatabaseTasks::runTestQuery protected function Run SQL tests to ensure the database can execute commands with the current user.
DatabaseTasks_sqlite::$pdoDriver protected property
DatabaseTasks_sqlite::getFormOptions public function Return driver specific configuration options. Overrides DatabaseTasks::getFormOptions
DatabaseTasks_sqlite::minimumVersion public function Minimum engine version. Overrides DatabaseTasks::minimumVersion
DatabaseTasks_sqlite::name public function Return the human-readable name of the driver. Overrides DatabaseTasks::name
DatabaseTasks_sqlite::validateDatabaseSettings public function Validates driver specific configuration settings. Overrides DatabaseTasks::validateDatabaseSettings