Commit e91a05e4 authored by anarcat's avatar anarcat Committed by anarcat

reduce the diff between the drupal 5 and drupal 6 install handlers, which...

reduce the diff between the drupal 5 and drupal 6 install handlers, which should fix some issues regarding email and language, maybe #570600
parent 1ce0ae89
......@@ -36,7 +36,6 @@ function install_verify_drupal() {
*/
function install_verify_settings() {
global $db_prefix, $db_type, $db_url;
// Verify existing settings (if any).
if ($db_url != 'mysql://username:password@localhost/databasename') {
// We need this because we want to run form_get_errors.
......@@ -109,7 +108,7 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_
$body = _user_mail_text('pass_body', $variables);
}
$mail_success = drupal_mail($mailkey, $account->mail, $subject, $body, $from);
$mail_success = drupal_mail($mailkey, $client_email, $subject, $body, $from);
if ($mail_success) {
drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message');
......@@ -118,12 +117,12 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_
drush_log(t('Could not send welcome mail to @client', array('@client' => $client_email)));
}
drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message');
}
function install_main() {
require_once './includes/bootstrap.inc';
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
// This must go after drupal_bootstrap(), which unsets globals!
global $profile, $install_locale, $client_email;
require_once './modules/system/system.install';
......@@ -165,7 +164,7 @@ function install_main() {
if ($severity == REQUIREMENT_ERROR) {
foreach ($requirements as $requirement) {
if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
drupal_set_message($requirement['descristion'] .' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')', 'error');
drupal_set_message($requirement['description'] .' ('. st('Currently using !item !version', array('!item' => $requirement['title'], '!version' => $requirement['value'])) .')', 'error');
}
}
......@@ -199,9 +198,10 @@ function install_main() {
variable_set('date_default_timezone', $tz_offset);
variable_set('install_profile', $profile);
$account = install_create_admin_user($url, $client_email);
if ($client_email) {
install_send_welcome_mail($url, $account, $profile, $language, $client_email);
install_send_welcome_mail($url, $account, $profile, $install_locale, $client_email);
}
}
install_main();
......@@ -16,9 +16,9 @@ case 443:
$base_url = 'https://' . $GLOBALS['url'];
break;
default:
$base_url = 'http://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
$base_url = 'http://' . $GLOBALS['url'] . ':' . drush_get_option('site_port');
break;
}
}
$GLOBALS['base_url'] = $base_url;
require_once 'includes/install.inc';
......@@ -95,40 +95,6 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_
drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message');
}
function install_mail($key, &$message, $params) {
switch ($key) {
case 'welcome-admin':
// allow the profile to override welcome email text
if (file_exists("./profiles/$profile/provision_welcome_mail.inc")) {
require_once "./profiles/$profile/provision_welcome_mail.inc";
$custom = TRUE;
}
elseif (file_exists(dirname(__FILE__) . '/../provision_welcome_mail.inc')) {
/** use the module provided welcome email
* We can not use drupal_get_path here,
* as we are connected to the provisioned site's database
*/
require_once dirname(__FILE__) . '/../provision_welcome_mail.inc';
$custom = TRUE;
}
else {
// last resort use the user-pass mail text
$custom = FALSE;
}
if ($custom) {
$message['subject'] = st($mail['subject'], $params['variables']);
$message['body'] = st($mail['body'], $params['variables']);
}
else {
$message['subject'] = _user_mail_text('pass_subject', $params['variables']);
$message['body'] = _user_mail_text('pass_body', $params['variables']);
}
break;
}
}
function install_main() {
require_once './includes/bootstrap.inc';
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
......@@ -166,13 +132,15 @@ function install_main() {
$conf['cache_inc'] = './includes/cache.inc';
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_DATABASE);
// Check if Drupal is installed.
if (install_verify_drupal()) {
return drush_set_error('PROVISION_DRUPAL_SITE_INSTALLED');
drush_set_error('PROVISION_DRUPAL_SITE_INSTALLED', st('Site is already installed'));
return FALSE;
}
}
else {
return drush_set_error('PROVISION_CONFIG_NOT_VALID');
drush_set_error('PROVISION_CONFIG_NOT_VALID', st('Config file could not be loaded'));
return FALSE;
}
......@@ -192,6 +160,7 @@ function install_main() {
*/
$requirements = drupal_check_profile($profile);
$severity = drupal_requirements_severity($requirements);
// If there are issues, report them.
if ($severity == REQUIREMENT_ERROR) {
foreach ($requirements as $requirement) {
......@@ -218,7 +187,7 @@ function install_main() {
}
// Verify existence of all required modules.
$modules = drupal_verify_profile($profile, $language);
$modules = drupal_verify_profile($profile, $install_locale);
if (!$modules) {
return drush_set_error('PROVISION_DRUPAL_INSTALL_FAILED');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment