3 use Drush\Log\LogLevel;
8 function drush_core_site_install_version($profile, array $additional_form_options = array()) {
9 require_once DRUSH_DRUPAL_CORE . '/includes/install.core.inc';
11 if (!isset($profile)) {
12 require_once DRUSH_DRUPAL_CORE . '/includes/file.inc';
13 require_once DRUSH_DRUPAL_CORE . '/includes/install.inc';
14 require_once DRUSH_DRUPAL_CORE . '/includes/common.inc';
15 require_once DRUSH_DRUPAL_CORE . '/includes/module.inc';
17 // If there is an installation profile that is marked as exclusive, use that
20 $profile = _install_select_profile(install_find_profiles());
22 catch (\Exception $e) {
23 // This is only a best effort to provide a better default, no harm done
26 if (empty($profile)) {
27 $profile = 'standard';
31 $sql = drush_sql_get_class();
32 $db_spec = $sql->db_spec();
34 $account_name = drush_get_option('account-name', 'admin');
35 $account_pass = drush_get_option('account-pass', FALSE);
36 $show_password = drush_get_option('show-passwords', !$account_pass);
38 $account_pass = drush_generate_password();
41 'parameters' => array(
42 'profile' => $profile,
43 'locale' => drush_get_option('locale', 'en'),
46 'install_settings_form' => array(
47 'driver' => $db_spec['driver'],
48 $db_spec['driver'] => $db_spec,
49 'op' => dt('Save and continue'),
51 'install_configure_form' => array(
52 'site_name' => drush_get_option('site-name', 'Site-Install'),
53 'site_mail' => drush_get_option('site-mail', 'admin@example.com'),
55 'name' => $account_name,
56 'mail' => drush_get_option('account-mail', 'admin@example.com'),
58 'pass1' => $account_pass,
59 'pass2' => $account_pass,
62 'update_status_module' => array(
66 'clean_url' => drush_get_option('clean-url', TRUE),
67 'op' => dt('Save and continue'),
72 // Merge in the additional options.
73 foreach ($additional_form_options as $key => $value) {
74 $current = &$settings['forms'];
75 foreach (explode('.', $key) as $param) {
76 $current = &$current[$param];
81 $msg = 'Starting Drupal installation. This takes a while.';
82 if (is_null(drush_get_option('notify'))) {
83 $msg .= ' Consider using the --notify global option.';
85 drush_log(dt($msg), LogLevel::OK);
86 drush_op('install_drupal', $settings);
88 drush_log(dt('Installation complete. User name: @name User password: @pass', array('@name' => $account_name, '@pass' => $account_pass)), LogLevel::OK);
91 drush_log(dt('Installation complete.'), LogLevel::OK);