summaryrefslogtreecommitdiff
path: root/includes/database/sqlite
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-29 02:55:57 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-29 02:55:57 +0000
commitff119bc0ccfa224279456c901904955a6b1f4d05 (patch)
tree7219f746418770bc7082236f9ddc031ba82042a8 /includes/database/sqlite
parent3d353c47fab804d22411bdfa87407b81a4a415c6 (diff)
downloadbrdo-ff119bc0ccfa224279456c901904955a6b1f4d05.tar.gz
brdo-ff119bc0ccfa224279456c901904955a6b1f4d05.tar.bz2
#346494 by hswong3i, Pancho, Dave Reid, duellj, dalin: Fixed DB drivers need to be able to change the configure database form during install
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r--includes/database/sqlite/install.inc27
1 files changed, 27 insertions, 0 deletions
diff --git a/includes/database/sqlite/install.inc b/includes/database/sqlite/install.inc
index 82ed0a48d..a8a12410d 100644
--- a/includes/database/sqlite/install.inc
+++ b/includes/database/sqlite/install.inc
@@ -21,5 +21,32 @@ class DatabaseTasks_sqlite extends DatabaseTasks {
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;
+ }
}