diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 493246c..64dbeb2 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -793,6 +793,18 @@ function install_verify_requirements(&$install_state) { * An array of information about the current installation state. */ function install_system_module(&$install_state) { + global $config_directory_name; + + // Actually create the config directory named above. + $config_path = conf_path() . '/files/' . $config_directory_name; + if (!file_prepare_directory($config_path, FILE_CREATE_DIRECTORY)) { + // How best to handle errors here? + }; + + // Write out a .htaccess file that will protect the config directory from + // prying eyes. + file_save_htaccess($config_path, TRUE); + // Install system.module. drupal_install_system(); @@ -838,12 +850,13 @@ function install_verify_completed_task() { } /** - * Verifies the existing settings in settings.php. + * Verifies the existing database and config directory settings. */ function install_verify_settings() { - global $databases; + global $databases, $config_directory_name; + $errors = array(); - // Verify existing settings (if any). + // Verify existing database settings (if any). if (!empty($databases) && install_verify_pdo()) { $database = $databases['default']['default']; drupal_static_reset('conf_path'); @@ -853,6 +866,15 @@ function install_verify_settings() { return TRUE; } } + + // Verify existing config directory (if set). + if (!empty($config_directory_name)) { + // Check that the specified config directory exists. + if (!file_prepare_directory($dir, 0)) { + throw new Exception(st("Your config directory, specified as %dir, does not exist or is not writeable. Please create this directory and set it to be writeable by the web server.", array('%dir' => $dir))); + } + } + return FALSE; } @@ -1011,34 +1033,19 @@ function install_settings_form_submit($form, &$form_state) { 'required' => TRUE, ); + // Create the config directory name while we're at it. $settings['config_signature_key'] = array( 'value' => drupal_hash_base64(drupal_random_bytes(55)), 'required' => TRUE, ); // This duplicates drupal_get_token() because that function can't work yet. - // Wondering if it makes sense to move this later in the process, but its - // nice having all the settings stuff here. - // - // @todo This is actually causing a bug right now, because you can install - // without hitting install_settings_form_submit() if your settings.php - // already has the db stuff in it, and right now in that case your - // config directory never gets created. So this needs to be moved elsewhere. $settings['config_directory_name'] = array( 'value' => 'config_' . drupal_hmac_base64('', session_id() . $settings['config_signature_key']['value'] . $settings['drupal_hash_salt']['value']), 'required' => TRUE, ); drupal_rewrite_settings($settings); - // Actually create the config directory named above. - $config_path = conf_path() . '/files/' . $settings['config_directory_name']['value']; - if (!file_prepare_directory($config_path, FILE_CREATE_DIRECTORY)) { - // How best to handle errors here? - }; - - // Write out a .htaccess file that will protect the config directory from - // prying eyes. - file_save_htaccess($config_path, TRUE); // Indicate that the settings file has been verified, and check the database // for the last completed task, now that we have a valid connection. This