-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
site_install_7.inc
93 lines (85 loc) · 2.88 KB
/
site_install_7.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
use Drush\Log\LogLevel;
/**
* Install Drupal 7
*/
function drush_core_site_install_version($profile, array $additional_form_options = array()) {
require_once DRUSH_DRUPAL_CORE . '/includes/install.core.inc';
if (!isset($profile)) {
require_once DRUSH_DRUPAL_CORE . '/includes/file.inc';
require_once DRUSH_DRUPAL_CORE . '/includes/install.inc';
require_once DRUSH_DRUPAL_CORE . '/includes/common.inc';
require_once DRUSH_DRUPAL_CORE . '/includes/module.inc';
// If there is an installation profile that is marked as exclusive, use that
// one.
try {
$profile = _install_select_profile(install_find_profiles());
}
catch (\Exception $e) {
// This is only a best effort to provide a better default, no harm done
// if it fails.
}
if (empty($profile)) {
$profile = 'standard';
}
}
$sql = drush_sql_get_class();
$db_spec = $sql->db_spec();
$account_name = drush_get_option('account-name', 'admin');
$account_pass = drush_get_option('account-pass', FALSE);
$show_password = drush_get_option('show-passwords', !$account_pass);
if (!$account_pass) {
$account_pass = drush_generate_password();
}
$settings = array(
'parameters' => array(
'profile' => $profile,
'locale' => drush_get_option('locale', 'en'),
),
'forms' => array(
'install_settings_form' => array(
'driver' => $db_spec['driver'],
$db_spec['driver'] => $db_spec,
'op' => dt('Save and continue'),
),
'install_configure_form' => array(
'site_name' => drush_get_option('site-name', 'Site-Install'),
'site_mail' => drush_get_option('site-mail', '[email protected]'),
'account' => array(
'name' => $account_name,
'mail' => drush_get_option('account-mail', '[email protected]'),
'pass' => array(
'pass1' => $account_pass,
'pass2' => $account_pass,
),
),
'update_status_module' => array(
1 => TRUE,
2 => TRUE,
),
'clean_url' => drush_get_option('clean-url', TRUE),
'op' => dt('Save and continue'),
),
),
);
// Merge in the additional options.
foreach ($additional_form_options as $key => $value) {
$current = &$settings['forms'];
foreach (explode('.', $key) as $param) {
$current = &$current[$param];
}
$current = $value;
}
$msg = 'Starting Drupal installation. This takes a while.';
if (is_null(drush_get_option('notify'))) {
$msg .= ' Consider using the --notify global option.';
}
drush_log(dt($msg), LogLevel::OK);
drush_op('install_drupal', $settings);
if ($show_password) {
drush_log(dt('Installation complete. User name: @name User password: @pass', array('@name' => $account_name, '@pass' => $account_pass)), LogLevel::OK);
}
else {
drush_log(dt('Installation complete.'), LogLevel::OK);
}
}