Commit d68f90e9 authored by clemens.tolboom's avatar clemens.tolboom Committed by helmo

Issue #1194602 by tstoeckler, clemens.tolboom: Working on the hosting of Drupal 8 sites.

parent 4be622db
...@@ -16,13 +16,30 @@ function install_send_welcome_mail($url, $account, $language, $client_email, $on ...@@ -16,13 +16,30 @@ function install_send_welcome_mail($url, $account, $language, $client_email, $on
if ($client_email) { if ($client_email) {
// Mail one time login URL and instructions. // Mail one time login URL and instructions.
$from = variable_get('site_mail', ini_get('sendmail_from')); $from = variable_get('site_mail', ini_get('sendmail_from'));
$username = $account->getUsername();
$site = variable_get('site_name', 'Drupal');
$uri_brief = preg_replace('!^https?://!', '', $base_url);
$mailto = $account->getEmail();
$date = format_date(time());
$login_uri = url('user', array('absolute' => TRUE));
$edit_uri = url('user/'. $account->id() .'/edit', array('absolute' => TRUE));
$mail_params['variables'] = array( $mail_params['variables'] = array(
'!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => $onetime, '!username' => $username,
'!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail, '!site' => $site,
'!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)), '!login_url' => $onetime,
'!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE))); '!uri' => $base_url,
'!uri_brief' => $uri_brief,
'!mailto' => $mailto,
'!date' => $date,
'!login_uri' => $login_uri,
'!edit_uri' => $edit_uri,
);
$mail_success = drupal_mail('install', 'welcome-admin', $account->mail, user_preferred_langcode($account), $mail_params, $from, TRUE); $langcode = $account->getPreferredLangcode();
$mail_success = drupal_mail('install', 'welcome-admin', $mailto, $langcode, $mail_params, $from, TRUE);
if ($mail_success) { if ($mail_success) {
drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message'); drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message');
...@@ -57,8 +74,8 @@ function install_mail($key, &$message, $params) { ...@@ -57,8 +74,8 @@ function install_mail($key, &$message, $params) {
} }
if ($custom) { if ($custom) {
$message['subject'] = st($mail['subject'], $params['variables']); $message['subject'] = t($mail['subject'], $params['variables']);
$message['body'][] = st($mail['body'], $params['variables']); $message['body'][] = t($mail['body'], $params['variables']);
} }
else { else {
$message['subject'] = _user_mail_text('pass_subject', $params['variables']); $message['subject'] = _user_mail_text('pass_subject', $params['variables']);
...@@ -84,6 +101,9 @@ function install_main() { ...@@ -84,6 +101,9 @@ function install_main() {
if (function_exists('drush_sql_read_db_spec')) { if (function_exists('drush_sql_read_db_spec')) {
$db_spec = drush_sql_read_db_spec(); $db_spec = drush_sql_read_db_spec();
} }
else if (function_exists('_drush_sql_get_db_spec')) {
$db_spec = _drush_sql_get_db_spec();
}
else { else {
$db_spec = drush_core_site_install_db_spec(); $db_spec = drush_core_site_install_db_spec();
} }
......
...@@ -9,9 +9,15 @@ ...@@ -9,9 +9,15 @@
*/ */
$mail = array(); $mail = array();
if (drush_drupal_major_version() >= 8) {
$mail['subject'] = st('Your new site !site has been created.'); $t = 't';
$mail['body'] = st("!username, }
else {
$t = 'st';
}
$mail['subject'] = $t('Your new site !site has been created.');
$mail['body'] = $t("!username,
Your new site !site has been created. Your new site !site has been created.
......
...@@ -31,6 +31,10 @@ function drush_provision_drupal_provision_login_reset() { ...@@ -31,6 +31,10 @@ function drush_provision_drupal_provision_login_reset() {
drush_set_option('login_link', $onetime); drush_set_option('login_link', $onetime);
drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'success'); drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'success');
if (drush_drupal_major_version() >= 8) {
require_once 'core/includes/session.inc';
}
if (drush_drupal_major_version() >= 7) { if (drush_drupal_major_version() >= 7) {
drupal_session_destroy_uid(1); drupal_session_destroy_uid(1);
} }
......
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