Form submission handler for install_settings_form().
install_settings_form_validate()
function install_settings_form_submit($form, &$form_state) {
global $install_state;
// Update global settings array and save.
$settings = array();
$database = $form_state['storage']['database'];
// Ideally, there is no difference between the code executed by the
// automated test browser and an ordinary browser. However, the database
// settings need a different format and also need to skip the password
// when testing. The hash salt also needs to be skipped because the original
// salt is used to verify the validity of the automated test browser.
// Because of these, there's a little difference in the code following but
// it is small and self-contained.
if ($test_prefix = drupal_valid_test_ua()) {
foreach ($form_state['storage']['database'] as $k => $v) {
if ($k != 'password') {
$settings['databases']['default']['default'][$k] = (object) array(
'value' => $v,
'required' => TRUE,
);
}
}
}
else {
$settings['databases']['default']['default'] = (object) array(
'value' => $database,
'required' => TRUE,
);
$settings['drupal_hash_salt'] = (object) array(
'value' => Crypt::randomStringHashed(55),
'required' => TRUE,
);
}
drupal_rewrite_settings($settings);
// Add the config directories to settings.php.
drupal_install_config_directories();
// 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
// last step is important since we want to trigger an error if the new
// database already has Drupal installed.
$install_state['settings_verified'] = TRUE;
$install_state['config_verified'] = TRUE;
$install_state['database_verified'] = TRUE;
$install_state['completed_task'] = install_verify_completed_task();
}