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