diff --git a/aegir.make b/aegir.make index c98843487bf6b14b470feb6d0bc856256cd7665f..b995edd7df1427aaae3ab6194596a35b19f86e05 100644 --- a/aegir.make +++ b/aegir.make @@ -6,4 +6,4 @@ projects[drupal][type] = "core" projects[hostmaster][type] = "profile" projects[hostmaster][download][type] = "git" projects[hostmaster][download][url] = "http://git.drupal.org/project/hostmaster.git" -projects[hostmaster][download][branch] = "6.x-1.x" +projects[hostmaster][download][tag] = "6.x-1.0-rc3" diff --git a/install.hostmaster.inc b/install.hostmaster.inc index 898239c0cc2e887a22463f082c1daa38aa3d77ce..24b11d210de9eda09c8c26eb20537c11cbb4d5f2 100644 --- a/install.hostmaster.inc +++ b/install.hostmaster.inc @@ -15,8 +15,9 @@ function drush_provision_hostmaster_install_validate($site = NULL) { drush_set_default('script_user', provision_current_user()); drush_set_default('web_group', _provision_default_web_group()); drush_set_default('http_service_type', 'apache'); - drush_set_default('drush_make_version', '6.x-2.1'); + drush_set_default('drush_make_version', '6.x-2.2'); drush_set_default('aegir_db_user', 'root'); + drush_set_default('client_name', 'admin'); $aegir_db_user = drush_get_option('aegir_db_user'); drush_set_default('makefile', $aegir_root . '/.drush/provision/aegir.make'); @@ -82,7 +83,7 @@ The following settings will be used: Aegir version: !version Aegir platform path: !root Aegir makefile: !makefile - Client email: !email + Admin email: !email ', array('!site' => $site, '!fqdn' => drush_get_option('aegir_host'), '!home' => drush_get_option('aegir_root'), @@ -186,10 +187,10 @@ function drush_provision_hostmaster_install($site = NULL) { 'platform' => $platform_name, 'db_server' => $dbserver, 'uri' => $site, - 'client_email' => drush_get_option('client_email'), + 'client_name' => drush_get_option('client_name'), 'profile' => 'hostmaster', )); - $data = provision_backend_invoke($site_name, 'provision-install'); + $data = provision_backend_invoke($site_name, 'provision-install', array(), array('client_email' => drush_get_option('client_email'))); provision_backend_invoke($site_name, 'provision-verify'); // exit if an error has occured. diff --git a/install.sh.txt b/install.sh.txt index caa4126eb9a4d086833af0af454184073901704e..338928a25d6bc34f9f251810f455d898ec2cd659 100644 --- a/install.sh.txt +++ b/install.sh.txt @@ -28,8 +28,8 @@ ######################################################################## # guess the aegir version based on the info file -AEGIR_VERSION="0.4-rc1" -DRUSH_VERSION=6.x-3.3 +AEGIR_VERSION="6.x-1.0-rc3" +DRUSH_VERSION=7.x-4.4 ######################################################################## # functions diff --git a/platform/backup.provision.inc b/platform/backup.provision.inc index 47fb67e96af75ed021391acd65d99df31343cd53..09cb48ac3a98df651b9736a057adb670e5d3f950 100644 --- a/platform/backup.provision.inc +++ b/platform/backup.provision.inc @@ -30,7 +30,7 @@ function drush_provision_drupal_provision_backup_validate($backup_file = NULL) { drush_set_error('PROVISION_BACKUP_ALREADY_EXISTS', dt('Back up file @path already exists.', array('@path' => $backup_file))); } else { - drush_log(dt('Backing site up to @path.', array('@path' => $backup_file)), 'ok'); + drush_log(dt('Backing site up to @path.', array('@path' => $backup_file))); drush_set_option('backup_file', $backup_file); } } @@ -110,6 +110,10 @@ function drush_provision_drupal_provision_backup() { } } +function drush_provision_drupal_post_provision_backup() { + drush_log(dt('Backed up site up to @path.', array('@path' => drush_get_option('backup_file'))), 'success'); +} + /** * Remove the backup file if something went wrong */ diff --git a/platform/drupal/install_5.inc b/platform/drupal/install_5.inc index 68bee336f8b4e328f314869d0654d19b0f99986e..fd6157368eb4b6a1f4c52ad88c8e7518ca568d3e 100644 --- a/platform/drupal/install_5.inc +++ b/platform/drupal/install_5.inc @@ -7,7 +7,6 @@ $GLOBALS['url'] = d()->uri; $GLOBALS['profile'] = d()->profile; $GLOBALS['install_locale'] = d()->language; -$GLOBALS['client_email'] = d()->client_email; $GLOBALS['base_url'] = provision_get_base_url(); @@ -60,11 +59,10 @@ function install_create_admin_user($client_email = NULL) { return user_save($account, $edit); } -function install_send_welcome_mail($url, $account, $profile, $language, $client_email) { +function install_send_welcome_mail($url, $account, $profile, $language, $client_email, $onetime) { global $base_url; // Mail one time login URL and instructions. $from = variable_get('site_mail', ini_get('sendmail_from')); - $onetime = user_pass_reset_url($account); $variables = array( '!username' => $account->name, '!site' => variable_get('site_name', 'Drupal'), '!login_url' => $onetime, @@ -72,9 +70,6 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_ '!date' => format_date(time()), '!login_uri' => url('user', NULL, NULL, TRUE), '!edit_uri' => url('user/'. $account->uid .'/edit', NULL, NULL, TRUE)); - // Store the one time login link in an option so the front end can direct the user to their new site. - drush_set_option('login_link', $onetime); - // 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"; @@ -110,7 +105,6 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_ else { 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() { @@ -118,7 +112,8 @@ function install_main() { drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION); // This must go after drupal_bootstrap(), which unsets globals! - global $profile, $install_locale, $client_email; + global $profile, $install_locale; + require_once './modules/system/system.install'; require_once './includes/file.inc'; @@ -193,9 +188,15 @@ function install_main() { variable_set('install_profile', $profile); - $account = install_create_admin_user($url, $client_email); + $client_email = drush_get_option('client_email'); + $account = install_create_admin_user($client_email); + $onetime = user_pass_reset_url($account); + // Store the one time login link in an option so the front end can direct the user to their new site. + drush_set_option('login_link', $onetime); + drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message'); + if ($client_email) { - install_send_welcome_mail($url, $account, $profile, $install_locale, $client_email); + install_send_welcome_mail($url, $account, $profile, $install_locale, $client_email, $onetime); } } install_main(); diff --git a/platform/drupal/install_6.inc b/platform/drupal/install_6.inc index 761585795bdaa8d177b371e12ad1e50e010a7cb1..6f0e1e1de781c2ab4f06a3d0f3fc5db2279250e3 100644 --- a/platform/drupal/install_6.inc +++ b/platform/drupal/install_6.inc @@ -7,7 +7,6 @@ $GLOBALS['url'] = d()->uri; $GLOBALS['profile'] = d()->profile; $GLOBALS['install_locale'] = d()->language; -$GLOBALS['client_email'] = d()->client_email; $GLOBALS['base_url'] = provision_get_base_url(); @@ -45,7 +44,6 @@ function install_verify_settings() { } function install_create_admin_user($client_email = NULL) { - global $client_email; if (!$client_email) { $client_email = 'webmaster@localhost'; } @@ -64,11 +62,11 @@ function install_create_admin_user($client_email = NULL) { return $account; } -function install_send_welcome_mail($url, $account, $profile, $language, $client_email) { +function install_send_welcome_mail($url, $account, $profile, $language, $client_email, $onetime) { global $base_url; // Mail one time login URL and instructions. $from = variable_get('site_mail', ini_get('sendmail_from')); - $onetime = user_pass_reset_url($account); + $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, @@ -77,16 +75,12 @@ function install_send_welcome_mail($url, $account, $profile, $language, $client_ $mail_success = drupal_mail('install', 'welcome-admin', $client_email, user_preferred_language($account), $mail_params, $from, TRUE); - // Store the one time login link in an option so the front end can direct the user to their new site. - drush_set_option('login_link', $onetime); - if ($mail_success) { drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message'); } else { 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_mail($key, &$message, $params) { @@ -129,7 +123,7 @@ function install_main() { drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION); // This must go after drupal_bootstrap(), which unsets globals! - global $profile, $install_locale, $client_email, $conf, $url; + global $profile, $install_locale, $conf, $url; require_once './modules/system/system.install'; require_once './includes/file.inc'; @@ -353,9 +347,15 @@ function install_main() { cache_clear_all(); variable_set('install_profile', $profile); - $account = install_create_admin_user($url, $client_email); + $client_email = drush_get_option('client_email'); + $account = install_create_admin_user($client_email); + $onetime = user_pass_reset_url($account); + // Store the one time login link in an option so the front end can direct the user to their new site. + drush_set_option('login_link', $onetime); + drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message'); + if ($client_email) { - install_send_welcome_mail($url, $account, $profile, $install_locale, $client_email); + install_send_welcome_mail($url, $account, $profile, $install_locale, $client_email, $onetime); } variable_set('install_task', 'done'); } diff --git a/platform/drupal/install_7.inc b/platform/drupal/install_7.inc index 484030f3f79edeb1ed9127a254dc50d2654ba330..7e1d5c894d63e304ecb855d615cd10c9124f38bd 100644 --- a/platform/drupal/install_7.inc +++ b/platform/drupal/install_7.inc @@ -7,29 +7,14 @@ $GLOBALS['url'] = d()->uri; $GLOBALS['profile'] = d()->profile; $GLOBALS['install_locale'] = d()->language; -$GLOBALS['client_email'] = d()->client_email; $GLOBALS['base_url'] = provision_get_base_url(); define('MAINTENANCE_MODE', 'install'); -function install_send_welcome_mail($url, $profile, $language, $client_email) { +function install_send_welcome_mail($url, $account, $language, $client_email, $onetime) { if ($client_email) { - // create the admin account - $account = user_load(1); - $edit['name'] = 'admin'; - $edit['pass'] = user_password(); - $edit['mail'] = $client_email; - $edit['status'] = 1; - - // temporarily disable drupal's default mail notification - $prev = variable_get('user_mail_status_activated_notify', TRUE); - variable_set('user_mail_status_activated_notify', FALSE); - $account = user_save($account, $edit); - variable_set('user_mail_status_activated_notify', $prev); - // Mail one time login URL and instructions. $from = variable_get('site_mail', ini_get('sendmail_from')); - $onetime = user_pass_reset_url($account); $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, @@ -38,17 +23,12 @@ function install_send_welcome_mail($url, $profile, $language, $client_email) { $mail_success = drupal_mail('install', 'welcome-admin', $account->mail, user_preferred_language($account), $mail_params, $from, TRUE); - // Store the one time login link in an option so the front end can direct the user to their new site. - drush_set_option('login_link', $onetime); - - if ($mail_success) { drush_log(t('Sent welcome mail to @client', array('@client' => $client_email)), 'message'); } else { drush_log(t('Could not send welcome mail to @client', array('@client' => $client_email))); } - drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message'); } } @@ -90,7 +70,9 @@ function install_mail($key, &$message, $params) { function install_main() { - global $profile, $install_locale, $client_email, $conf, $url, $base_url; + global $profile, $install_locale, $conf, $url, $base_url; + + $client_email = drush_get_option('client_email'); require_once DRUPAL_ROOT . '/includes/install.core.inc'; @@ -147,8 +129,26 @@ function install_main() { } _provision_drupal_create_directories(); + // create the admin account + $account = user_load(1); + $edit['name'] = 'admin'; + $edit['pass'] = $account_pass; + $edit['mail'] = $client_email; + $edit['status'] = 1; + + // temporarily disable drupal's default mail notification + $prev = variable_get('user_mail_status_activated_notify', TRUE); + variable_set('user_mail_status_activated_notify', FALSE); + $account = user_save($account, $edit); + variable_set('user_mail_status_activated_notify', $prev); + + $onetime = user_pass_reset_url($account); + // Store the one time login link in an option so the front end can direct the user to their new site. + drush_set_option('login_link', $onetime); + drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message'); + if ($client_email) { - install_send_welcome_mail($url, $profile, $install_locale, $client_email); + install_send_welcome_mail($url, $account, $install_locale, $client_email, $onetime); } } install_main(); diff --git a/platform/install.provision.inc b/platform/install.provision.inc index 17a31b54af2052a68edae0f1d3e8a31989f463d9..2e7561f076b2b4d76daae6dca21452c858a5b6e7 100644 --- a/platform/install.provision.inc +++ b/platform/install.provision.inc @@ -55,7 +55,7 @@ function drush_provision_drupal_provision_install() { drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE); // call a backend task to do the actual installation. - $result = provision_backend_invoke(d()->name, "provision-install-backend"); + $result = provision_backend_invoke(d()->name, "provision-install-backend", array(), array('client_email' => drush_get_option('client_email'))); // pass the login link back to the front end. drush_set_option('login_link', $result['context']['login_link']); diff --git a/provision.config.inc b/provision.config.inc index 75acfe3b41e0f437f150ef33c00dc5560ed556fe..3ce70350e9fc7590d9ffdf34d51615b4e0ffc6f3 100644 --- a/provision.config.inc +++ b/provision.config.inc @@ -293,6 +293,8 @@ class provisionConfig_drushrc_server extends provisionConfig_drushrc { class provisionConfig_drushrc_platform extends provisionConfig_drushrc { protected $context_name = 'drupal'; public $description = 'Platform Drush configuration file'; + // platforms contain no confidential information + protected $mode = 0444; function filename() { return $this->root . '/drushrc.php'; diff --git a/provision.context.site.inc b/provision.context.site.inc index 397e312cca9bedaeaf712429fc6e751d7905b2f3..b9643db2de93bbc233f56b81e121e411eeca4f0f 100644 --- a/provision.context.site.inc +++ b/provision.context.site.inc @@ -16,7 +16,7 @@ class provisionContext_site extends provisionContext { '--language' => 'site: site language; default en', '--aliases' => 'site: comma-separated URIs', '--redirection' => 'site: boolean for whether --aliases should redirect; default false', - '--client_email' => 'site: email for the site owner', + '--client_name' => 'site: machine name of the client that owns this site', '--profile' => 'site: Drupal profile to use; default default', ); } @@ -32,7 +32,7 @@ class provisionContext_site extends provisionContext { $this->setProperty('site_enabled', true); $this->setProperty('language', 'en'); - $this->setProperty('client_email'); + $this->setProperty('client_name'); $this->setProperty('aliases', array(), TRUE); $this->setProperty('redirection', FALSE); diff --git a/provision.inc b/provision.inc index c096f7d158d7932cf20293fb4a382d0de4ce3584..72ebd0776ef957198744f0108bba91cccaf17bd0 100644 --- a/provision.inc +++ b/provision.inc @@ -253,6 +253,15 @@ function provision_posix_groupname($group) { return $group; } +/** + * Generate a random alphanumeric password. + * + * This is a copy of Drupal core's user_password() function. We keep it + * here in case we need this and don't have a bootstrapped Drupal + * around. + * + * @see user_password() + */ function provision_password($length = 10) { // This variable contains the list of allowable characters for the // password. Note that the number 0 and the letter 'O' have been diff --git a/upgrade.sh.txt b/upgrade.sh.txt index 870acee2478f824beacad4a03c61cc476640e3a3..19f293b78c8ba41563e50ba047e901954124b45d 100644 --- a/upgrade.sh.txt +++ b/upgrade.sh.txt @@ -11,14 +11,14 @@ ######################################################################## # basic variables, change before running -AEGIR_VERSION="6.x-1.0-rc2" +AEGIR_VERSION="6.x-1.0-rc3" AEGIR_DOMAIN=aegir.example.com AEGIR_HOME="$HOME" DRUPAL_DIR=$AEGIR_HOME/hostmaster-$AEGIR_VERSION -DRUSH_VERSION=6.x-3.3 -DRUSH_MAKE_VERSION=6.x-2.1 -OLD_DRUPAL_DIR=$AEGIR_HOME/hostmaster-0.4-rc1 +DRUSH_VERSION=7.x-4.4 +DRUSH_MAKE_VERSION=6.x-2.2 +OLD_DRUPAL_DIR=$AEGIR_HOME/hostmaster-6.x-1.0-rc2 DRUSH_DIR=$AEGIR_HOME/drush DRUSH="php $DRUSH_DIR/drush.php" BACKUP_DIR=$AEGIR_HOME/pre-upgrade-`date '+%F-%H%M'`