summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclemenstolboom2013-09-25 13:33:41 (GMT)
committerHerman van Rink2013-09-25 13:33:41 (GMT)
commitd68f90e9001a4352e017063860efe56522b2001b (patch)
treec51561c4836ec9d77919d26496f4ba0dda979c38
parent4be622dba91f2dc9f9073775236743f3cfafbc8c (diff)
Issue #1194602 by tstoeckler, clemens.tolboom: Working on the hosting of Drupal 8 sites.
-rw-r--r--platform/drupal/install_8.inc34
-rw-r--r--platform/provision_welcome_mail.inc12
-rw-r--r--platform/reset.login.provision.inc4
3 files changed, 40 insertions, 10 deletions
diff --git a/platform/drupal/install_8.inc b/platform/drupal/install_8.inc
index bcff088..5a801ac 100644
--- a/platform/drupal/install_8.inc
+++ b/platform/drupal/install_8.inc
@@ -16,13 +16,30 @@ function install_send_welcome_mail($url, $account, $language, $client_email, $on
if ($client_email) {
// Mail one time login URL and instructions.
$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(
- '!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => $onetime,
- '!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail,
- '!date' => format_date(time()), '!login_uri' => url('user', array('absolute' => TRUE)),
- '!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE)));
+ '!username' => $username,
+ '!site' => $site,
+ '!login_url' => $onetime,
+ '!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) {
drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message');
@@ -57,8 +74,8 @@ function install_mail($key, &$message, $params) {
}
if ($custom) {
- $message['subject'] = st($mail['subject'], $params['variables']);
- $message['body'][] = st($mail['body'], $params['variables']);
+ $message['subject'] = t($mail['subject'], $params['variables']);
+ $message['body'][] = t($mail['body'], $params['variables']);
}
else {
$message['subject'] = _user_mail_text('pass_subject', $params['variables']);
@@ -84,6 +101,9 @@ function install_main() {
if (function_exists('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 {
$db_spec = drush_core_site_install_db_spec();
}
diff --git a/platform/provision_welcome_mail.inc b/platform/provision_welcome_mail.inc
index b7c156a..c93b589 100644
--- a/platform/provision_welcome_mail.inc
+++ b/platform/provision_welcome_mail.inc
@@ -9,9 +9,15 @@
*/
$mail = array();
-
-$mail['subject'] = st('Your new site !site has been created.');
-$mail['body'] = st("!username,
+if (drush_drupal_major_version() >= 8) {
+ $t = 't';
+}
+else {
+ $t = 'st';
+}
+
+$mail['subject'] = $t('Your new site !site has been created.');
+$mail['body'] = $t("!username,
Your new site !site has been created.
diff --git a/platform/reset.login.provision.inc b/platform/reset.login.provision.inc
index b5bec56..6a71267 100644
--- a/platform/reset.login.provision.inc
+++ b/platform/reset.login.provision.inc
@@ -31,6 +31,10 @@ function drush_provision_drupal_provision_login_reset() {
drush_set_option('login_link', $onetime);
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) {
drupal_session_destroy_uid(1);
}