1 install.core.inc | install_configure_form_submit($form, &$form_state) |
Form submission handler for install_configure_form().
See also
install_configure_form_validate()
File
- core/
includes/ install.core.inc, line 2348 - API functions for installing Backdrop.
Code
function install_configure_form_submit($form, &$form_state) {
global $user;
$timezone = $form_state['values']['date_default_timezone'];
$timezone_country = _install_get_timezone_country($timezone);
config('system.core')
->set('site_name', $form_state['values']['site_name'])
->save();
config('system.date')
->set('default_timezone', $timezone)
->set('default_country', $timezone_country)
->save();
// Update the default date/time formats for different regions.
if ($timezone_country == 'US') {
config('system.date')
->set('formats.long.pattern', 'l, F j, Y - g:ia')
->set('formats.medium.pattern', 'D, m/d/Y - g:ia')
->set('formats.short.pattern', 'm/d/Y - g:ia')
->set('formats.date_only.pattern', 'm/d/Y')
->save();
}
// Enable checking for updates on cron.
if (module_exists('update')) {
// Set the update interval to 0 if automatic checking is disabled.
config_set('update.settings', 'update_interval_days', (int) $form_state['values']['update_status_module'][1]);
// Add the site maintenance account's email address to the list of
// addresses to be notified when updates are available, if selected.
if ($form_state['values']['update_status_module'][2]) {
config_set('update.settings', 'update_emails', array($form_state['values']['account']['mail']));
}
}
// We pre-created user 1 with placeholder values. Let's save the real values.
$account = user_load(1);
$account->init = $account->mail = $form_state['values']['account']['mail'];
$account->roles = !empty($account->roles) ? $account->roles : array();
$account->status = 1;
$account->timezone = $timezone;
$account->pass = $form_state['values']['account']['pass'];
$account->name = $form_state['values']['account']['name'];
$account->save();
// Load global $user and perform final login tasks.
$user = user_load(1);
user_login_finalize();
if (isset($form_state['values']['clean_url'])) {
config_set('system.core', 'clean_url', $form_state['values']['clean_url']);
backdrop_static_reset('url');
}
// Record when this install ran.
state_set('install_time', $_SERVER['REQUEST_TIME']);
}