Skip to content
Commits on Source (38)
......@@ -15,11 +15,16 @@ class Provision_Config_Drupal_Settings extends Provision_Config {
}
function process() {
if (drush_drupal_major_version() >= 8) {
$this->data['config_directories_active_var'] = 'config_directories_active';
$this->data['config_directories_staging_var'] = 'config_directories_staging';
}
if (drush_drupal_major_version() >= 7) {
$this->data['db_type'] = ($this->data['db_type'] == 'mysqli') ? 'mysql' : $this->data['db_type'];
$this->data['file_directory_path_var'] = 'file_public_path';
$this->data['file_directory_temp_var'] = 'file_temporary_path';
$this->data['file_directory_private_var'] = 'file_private_path';
$this->data['drupal_hash_salt_var'] = 'empty';
}
else {
$this->data['file_directory_path_var'] = 'file_directory_path';
......
......@@ -130,7 +130,18 @@ if (isset($_SERVER['db_name'])) {
$conf['<?php print $file_directory_temp_var ?>'] = 'sites/<?php print $this->uri ?>/private/temp';
<?php if (isset($file_directory_private_var)): ?>
$conf['<?php print $file_directory_private_var ?>'] = 'sites/<?php print $this->uri ?>/private/files';
<?php endif; ?>
<?php endif; ?>
<?php if (isset($drupal_hash_salt_var)): ?>
$drupal_hash_salt = '';
<?php endif; ?>
<?php if (isset($config_directories_active_var)): ?>
$config_directories['active']['path'] = 'sites/<?php print $this->uri ?>/private/config/active';
$config_directories['active']['absolute'] = TRUE;
<?php endif; ?>
<?php if (isset($config_directories_staging_var)): ?>
$config_directories['staging']['path'] = 'sites/<?php print $this->uri ?>/private/config/staging';
$config_directories['staging']['absolute'] = TRUE;
<?php endif; ?>
$conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print !$this->backup_in_progress ? $this->api_version : 0 ?>;
......
......@@ -3,9 +3,9 @@ api = 2
projects[drupal][type] = "core"
projects[drupal][version] = "6.28"
projects[drupal][patch][] = "https://drupal.org/files/common.inc_6.28.patch"
projects[drupal][patch][] = "http://drupal.org/files/common.inc_6.28.patch"
projects[hostmaster][type] = "profile"
projects[hostmaster][download][type] = "git"
projects[hostmaster][download][url] = "http://git.drupal.org/project/hostmaster.git"
projects[hostmaster][download][tag] = "6.x-2.x"
projects[hostmaster][download][branch] = "6.x-2.x"
aegir-provision2 (2.0~rc4) unstable; urgency=low
* Fixes a missed step in the 2.0~rc3 release process.
-- Christopher Gervais <chris@ergonlogic.com> Fri, 30 Aug 2013 15:46:06 -0400
aegir-provision2 (2.0~rc3) unstable; urgency=low
* This release mainly fixes a couple critical bugs in 2.0-rc2 that were
causing problems when sites were being cloned or renamed.
* We've added a couple small features, such as additional options during
hostmaster-install, and allowing the redirect to the Welcome page to be
turned off.
* Also, we've made a small addition to the API, in that there is now a hook
available (hook_provision_drupal_create_directories_alter()) to allow
altering the directories created when a site installed.
-- Christopher Gervais <chris@ergonlogic.com> Thu, 29 Aug 2013 11:53:43 -0400
aegir-provision2 (2.0~rc2) unstable; urgency=low
* This release mainly fixes an error during the rc1 release, which had not
......
......@@ -44,9 +44,9 @@ if (sizeof($this->aliases)) {
RewriteEngine on
<?php
if ($this->redirection) {
// Redirect all aliases to the main https url.
print " RewriteCond %{HTTP_HOST} !^{$this->uri}$ [NC]\n";
print " RewriteRule ^/*(.*)$ https://{$this->uri}/$1 [NE,L,R=301]\n";
// Redirect to the selected alias.
print " RewriteCond %{HTTP_HOST} !^{$this->redirection}$ [NC]\n";
print " RewriteRule ^/*(.*)$ https://{$this->redirection}/$1 [NE,L,R=301]\n";
}
?>
RewriteRule ^/files/(.*)$ /sites/<?php print $this->uri; ?>/files/$1 [L]
......
......@@ -4,6 +4,29 @@
* @file install the hostmaster system
*/
/**
* Implements drush_COMMAND_pre_validate().
*
* Ensure the database cannot be accessed by anonymous users, as it will
* otherwise fail later in the install, and thus be harder to recover from.
*
* @see Provision_Service_db_mysql::grant_host().
*/
function drush_provision_hostmaster_install_pre_validate() {
$command = sprintf('mysql -u intntnllyInvalid -h %s -P %s -e "SELECT VERSION()"', drush_get_option('aegir_db_host', 'localhost'), drush_get_option('aegir_db_port', '3306'));
drush_shell_exec($command);
if (preg_match("/Access denied for user 'intntnllyInvalid'@'([^']*)'/", implode('', drush_shell_exec_output()), $match)) {
return;
}
elseif (preg_match("/Host '([^']*)' is not allowed to connect to/", implode('', drush_shell_exec_output()), $match)) {
return;
}
else {
return drush_set_error('PROVISION_DB_CONNECT_FAIL', dt('Dummy connection failed to fail. Either your MySQL permissions are too lax, or the response was not understood. See http://is.gd/Y6i4FO for more information. %msg', array('%msg' => join("\n", drush_shell_exec_output()))));
}
}
function drush_provision_hostmaster_install_validate($site = NULL) {
// set defaults for this whole script
// those are settings that are not prompted to the user but still overridable
......@@ -15,7 +38,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('http_port', '80');
drush_set_default('aegir_db_user', 'root');
drush_set_default('aegir_db_port', '3306');
drush_set_default('client_name', 'admin');
$aegir_db_user = drush_get_option('aegir_db_user');
drush_set_default('makefile', dirname(__FILE__) . '/aegir.make');
......@@ -41,7 +66,7 @@ Don't worry: you will get to review those settings after the final install");
system('stty -echo');
drush_set_option('aegir_db_pass', drush_prompt(dt('MySQL privileged user ("!root") password', array('!root' => $aegir_db_user))));
system('stty echo');
print "\n"; // add a newline since the user's didn't print
print "\n"; // add a newline since the user's didn't print
}
if (drush_get_option('aegir_host') == 'localhost') {
......@@ -75,9 +100,11 @@ The following settings will be used:
Aegir user: !user
Web group: !web
Web server: !web_server
Web server port: !web_server_port
Aegir DB host: !db_host
Aegir DB user: !db_user
Aegir DB password: !db_pass
Aegir DB port: !db_port
Aegir version: !version
Aegir platform path: !root
Aegir makefile: !makefile
......@@ -88,9 +115,11 @@ The following settings will be used:
'!user' => drush_get_option('script_user'),
'!web' => drush_get_option('web_group'),
'!web_server' => drush_get_option('http_service_type'),
'!web_server_port' => drush_get_option('http_port'),
'!db_host' => drush_get_option('aegir_db_host'),
'!db_user' => drush_get_option('aegir_db_user'),
'!db_pass' => is_null(drush_get_option('aegir_db_pass', NULL, 'process')) ? '<previously set>' : '<prompted>',
'!db_port' => drush_get_option('aegir_db_port'),
'!version' => drush_get_option('version'),
'!root' => drush_get_option(array('r', 'root')),
'!makefile' => drush_get_option('makefile'),
......@@ -113,34 +142,41 @@ function drush_provision_hostmaster_install($site = NULL) {
$aegir_root = drush_get_option('aegir_root');
$platform = drush_get_option(array('r', 'root'));
$aegir_http_host = drush_get_option('aegir_host');
$aegir_http_port = drush_get_option('http_port');
$aegir_db_user = drush_get_option('aegir_db_user');
$aegir_db_pass = drush_get_option('aegir_db_pass');
$aegir_db_port = drush_get_option('aegir_db_port');
$aegir_db_host = drush_get_option('aegir_db_host');
$server = '@server_master';
$master_context = array(
'context_type' => 'server',
// files
'remote_host' => drush_get_option('aegir_host'),
'remote_host' => $aegir_http_host,
'aegir_root' => $aegir_root,
'script_user' => drush_get_option('script_user'),
// apache or nginx or..
'http_service_type' => drush_get_option('http_service_type'),
'http_port' => $aegir_http_port,
'web_group' => drush_get_option('web_group'),
'master_url' => "http://" . $site,
'db_port' => $aegir_db_port,
);
$master_db = sprintf("mysql://%s:%s@%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), drush_get_option('aegir_db_host'));
if (drush_get_option('aegir_host') == drush_get_option('aegir_db_host')) {
$master_db = sprintf("mysql://%s:%s@%s:%s", urlencode($aegir_db_user), urlencode($aegir_db_pass), $aegir_db_host, $aegir_db_port);
if ($aegir_http_host == $aegir_db_host) {
$master_context['db_service_type'] = 'mysql';
$master_context['master_db'] = $master_db;
$dbserver = $server;
} else {
$dbserver = '@server_' . drush_get_option('aegir_db_host');
$dbserver = '@server_' . $aegir_db_host;
$dbserver_context = array(
'remote_host' => drush_get_option('aegir_db_host'),
'remote_host' => $aegir_db_host,
'context_type' => 'server',
'db_service_type' => 'mysql',
'master_db' => $master_db,
'db_port' => $aegir_db_port,
);
drush_invoke_process('@none', "provision-save", array($dbserver), $dbserver_context);
provision_backend_invoke($dbserver, 'provision-verify');
......@@ -148,7 +184,7 @@ function drush_provision_hostmaster_install($site = NULL) {
drush_invoke_process('@none', "provision-save", array($server), $master_context);
provision_backend_invoke($server, 'provision-verify');
// exit if an error has occured.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......@@ -172,7 +208,7 @@ function drush_provision_hostmaster_install($site = NULL) {
}
provision_backend_invoke($platform_name, 'provision-verify', array(), $options);
// exit if an error has occured.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......@@ -192,7 +228,7 @@ function drush_provision_hostmaster_install($site = NULL) {
$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.
// exit if an error has occured.
if (drush_get_error()) {
return false;
}
......
......@@ -71,4 +71,6 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
provision_backend_invoke($new_uri, 'provision-verify');
}
provision_reload_config('site', d()->site_path . '/drushrc.php');
}
<?php
// $Id$
/**
* @file
* Rebuild all the caches
*/
drupal_flush_all_caches();
drush_log(t('All caches flushed'));
<?php
// Fetch the cron key from the Drupal site and set in a drush context.
drush_set_option('cron_key', variable_get('cron_key', 'drupal'));
\ No newline at end of file
<?php
// $Id$
$new_url = d()->uri;
/**
* @deprecated in drush3 it's 'options', in drush 4 it's 'cli', drop
* 'options' when we drop drush3 support
*/
$context = drush_get_context('cli') ? 'cli' : 'options';
$old_url = drush_get_option('old_uri', $new_url, $context);
/**
* @file
* Handle site migration tasks for redeployed sites.
* This is primarily to handle the rename of the sites
* directories.
*/
if (db_table_exists('file_managed')) {
db_query("UPDATE {file_managed} SET uri = REPLACE(uri, :old, :new)", array(':old' => 'sites/default', ':new' => 'sites/$new_url'));
db_query("UPDATE {file_managed} SET uri = REPLACE(uri, :old, :new)", array(':old' => 'sites/$old_url', ':new' => 'sites/$new_url'));
}
if (db_table_exists('files')) {
db_query("UPDATE {files} SET filepath = REPLACE(filepath, :old, :new)", array(':old' => 'sites/$old_url', ':new' => 'sites/$new_url'));
db_query("UPDATE {files} SET filepath = REPLACE(filepath, :old, :new)", array(':old' => 'sites/default', ':new' => 'sites/$new_url'));
}
variable_set('file_public_path', "sites/$new_url/files");
variable_set('file_private_path', "sites/$new_url/private/files");
variable_set('file_temporary_path', "sites/$new_url/private/temp");
drush_log(
dt('Changed paths from sites/@old_url to sites/@new_url',
array('@old_url' => $old_url, '@new_url' => $new_url)));
......@@ -7,7 +7,7 @@ if ($db = $databases['default']['default']) {
drush_set_option('db_passwd', urldecode($db['password']), 'site');
drush_set_option('db_name', urldecode($db['database']), 'site');
drush_set_option('profile', variable_get('install_profile', 'default'), 'site');
drush_set_option('profile', variable_get('install_profile', 'standard'), 'site');
$language = language_default();
drush_set_option('language', $language->language, 'site');
}
<?php
global $databases;
if ($db = $databases['default']['default']) {
drush_set_option('db_type', urldecode($db['driver']), 'site');
drush_set_option('db_user', urldecode($db['username']), 'site');
drush_set_option('db_host', urldecode($db['host']), 'site');
drush_set_option('db_passwd', urldecode($db['password']), 'site');
drush_set_option('db_name', urldecode($db['database']), 'site');
drush_set_option('profile', variable_get('install_profile', 'standard'), 'site');
$language = language_default();
drush_set_option('language', $language->language, 'site');
}
......@@ -13,10 +13,11 @@ define('PROVISION_DEFAULT_ADMIN_USER', 'admin');
function install_validate_client_email($client_email) {
if (!$client_email || !filter_var($client_email, FILTER_VALIDATE_EMAIL)) {
$invalid_email = 'this.email@is.invalid';
$user = function_exists('l') ? l(t('user account'), 'user') : 'user account';
drush_log(t('Error validating client email `!email`. Please check your !user email. To allow the site installation to proceed, the email `!invalid` has been used instead. Please use the `login` link to change the site admin email to a proper valid address.',
array(
'!email' => $client_email,
'!user' => l(t('user account'), 'user'),
'!user' => $user,
'!invalid' => $invalid_email,
)),
'warning'
......
<?php
/**
* @file
* Rebuild all the caches
*/
$GLOBALS['url'] = d()->uri;
$GLOBALS['profile'] = d()->profile;
$GLOBALS['install_locale'] = d()->language;
$GLOBALS['base_url'] = provision_get_base_url();
define('MAINTENANCE_MODE', 'install');
function install_send_welcome_mail($url, $account, $language, $client_email, $onetime) {
global $base_url;
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' => $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,
);
$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');
}
else {
drush_log(t('Could not send welcome mail to @client', array('@client' => $client_email)));
}
}
}
function install_mail($key, &$message, $params) {
global $profile;
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'] = t($mail['subject'], $params['variables']);
$message['body'][] = t($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() {
global $profile, $install_locale, $conf, $url, $base_url;
$client_email = drush_get_option('client_email');
require_once DRUPAL_ROOT . '/core/includes/install.core.inc';
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
// We have an existing settings.php.
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();
}
$db_spec['db_prefix'] = $GLOBALS['db_prefix'];
if ($db_spec['driver'] == 'mysqli') {
$db_spec['driver'] = 'mysql';
}
unset($conf['site_name']);
unset($conf['site_mail']);
unset($GLOBALS['db_url']);
$account_pass = provision_password();
$settings = array(
'parameters' => array(
'profile' => $profile,
'locale' => $install_locale,
),
'settings_verified' => TRUE,
'forms' => array(
'install_settings_form' => $db_spec,
'install_configure_form' => array(
'site_name' => $url,
'site_mail' => $client_email ? $client_email : 'admin@example.com',
'account' => array(
'name' => 'admin',
'mail' => $client_email ? $client_email : 'admin@example.com',
'pass' => array(
'pass1' => $account_pass,
'pass2' => $account_pass,
),
),
'update_status_module' => array(
1 => TRUE,
2 => TRUE,
),
'clean_url' => drush_get_option('clean_url', TRUE),
),
),
);
try {
install_drupal($settings);
}
catch (Exception $e) {
drush_set_error('DRUPAL_INSTALL_FAILED');
dlm($e);
}
_provision_drupal_create_directories();
// create the admin account
$account = user_load(1);
$account->name = 'admin';
$account->pass = $account_pass;
$account->mail = $client_email;
$account->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->save();
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 . '/login');
drush_log(t('Login url: !onetime', array('!onetime' => $onetime . '/login')), 'message');
if ($client_email) {
install_send_welcome_mail($url, $account, $install_locale, $client_email, $onetime);
}
}
install_main();
function install_exception_handler() {
dlm(func_get_args());
}
<?php
// $Id$
/**
* @file Package management code for Drupal 8
*/
/**
* Find themes in a certain scope
*
* This function is based on _system_theme_data in Drupal 6 and Drupal 7.
* We do not support, nor need information on subthemes at this point.
*/
function _provision_drupal_find_themes($scope, $key = '') {
$paths = _provision_drupal_search_paths($scope, $key, 'themes');
$files = array();
$engines = array();
foreach ($paths as $path) {
$files = array_merge($files, drush_scan_directory($path, "/\.info$/", array('.', '..', 'CVS', '.svn'), 0, true, 'name'));
$engines = array_merge($engines, drush_scan_directory($path . "/engines", "/\.engine$/", array('.', '..', 'CVS', '.svn'), 0, true, 'name'));
}
foreach ($files as $name => $file) {
$files[$name]->info = _provision_drupal_parse_info_file($file->filename);
if (!empty($files[$name]->info['name'])) {
$files[$name]->name = $files[$name]->info['name'];
}
if (empty($files[$name]->info['engine'])) {
$filename = dirname($files[$name]->filename) .'/'. $files[$name]->name .'.theme';
if (file_exists($filename)) {
$files[$name]->owner = $filename;
$files[$name]->prefix = $name;
}
}
else {
$engine = $files[$name]->info['engine'];
if (isset($engines[$engine])) {
$files[$name]->owner = $engines[$engine]->filename;
$files[$name]->prefix = $engines[$engine]->name;
$files[$name]->template = TRUE;
}
}
_provision_cvs_deploy($files[$name]);
}
return $files;
}
/**
* This code is based on the Drupal 6 and Drupal 7 drupal_parse_info_file
*/
function _provision_drupal_parse_info_file($filename) {
$info = array();
$constants = get_defined_constants();
if (!file_exists($filename)) {
return $info;
}
$data = file_get_contents($filename);
if (preg_match_all('
@^\s* # Start at the beginning of a line, ignoring leading whitespace
((?:
[^=;\[\]]| # Key names cannot contain equal signs, semi-colons or square brackets,
\[[^\[\]]*\] # unless they are balanced and not nested
)+?)
\s*=\s* # Key/value pairs are separated by equal signs (ignoring white-space)
(?:
("(?:[^"]|(?<=\\\\)")*")| # Double-quoted string, which may contain slash-escaped quotes/slashes
(\'(?:[^\']|(?<=\\\\)\')*\')| # Single-quoted string, which may contain slash-escaped quotes/slashes
([^\r\n]*?) # Non-quoted string
)\s*$ # Stop at the next end of a line, ignoring trailing whitespace
@msx', $data, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
// Fetch the key and value string
$i = 0;
foreach (array('key', 'value1', 'value2', 'value3') as $var) {
$$var = isset($match[++$i]) ? $match[$i] : '';
}
$value = stripslashes(substr($value1, 1, -1)) . stripslashes(substr($value2, 1, -1)) . $value3;
// Parse array syntax
$keys = preg_split('/\]?\[/', rtrim($key, ']'));
$last = array_pop($keys);
$parent = &$info;
// Create nested arrays
foreach ($keys as $key) {
if ($key == '') {
$key = count($parent);
}
if (!isset($parent[$key]) || !is_array($parent[$key])) {
$parent[$key] = array();
}
$parent = &$parent[$key];
}
// Handle PHP constants.
if (isset($constants[$value])) {
$value = $constants[$value];
}
// Insert actual value
if ($last == '') {
$last = count($parent);
}
$parent[$last] = $value;
}
}
return $info;
}
function _provision_system_query($type) {
$entries = array();
$result = db_query("SELECT * FROM {system} WHERE type=:type", array(':type' => $type));
foreach ($result as $entry) {
$entries[] = $entry;
}
return $entries;
}
<?php
// $Id$
/**
* @file
* Find modules, themes and themes engines
*/
drush_set_option('modules', _scrub_object(module_rebuild_cache()), 'site');
// Find theme engines
drush_set_option('engines', _scrub_object(drupal_system_listing('\.engine$', 'themes/engines')), 'site');
drush_set_option('themes', _scrub_object(system_theme_data()), 'site');
if (drush_drupal_major_version() >= 7) {
drush_set_option('modules', _scrub_object(system_rebuild_module_data()), 'site');
drush_set_option('themes', _scrub_object(system_rebuild_theme_data()), 'site');
}
else {
drush_set_option('modules', _scrub_object(module_rebuild_cache()), 'site');
drush_set_option('themes', _scrub_object(system_theme_data()), 'site');
}
drush_set_option('engines', _scrub_object(drupal_system_listing('\.engine$', 'themes/engines')), 'site');
......@@ -233,6 +233,19 @@ function _provision_drupal_create_directories($url = NULL, $profile = NULL) {
$mkdir["sites/$url/private/temp"] = 02770;
$chgrp["sites/$url/private/temp"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/styles"] = 02770;
$chgrp["sites/$url/files/styles"] = d('@server_master')->web_group;
// d8 support
$mkdir["sites/$url/private/config"] = 02770;
$chgrp["sites/$url/private/config"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/config/active"] = 02770;
$chgrp["sites/$url/private/config/active"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/config/staging"] = 02770;
$chgrp["sites/$url/private/config/staging"] = d('@server_master')->web_group;
}
// These paths should not have recursive operations performed on them.
......@@ -249,9 +262,18 @@ function _provision_drupal_create_directories($url = NULL, $profile = NULL) {
"sites/$url/files/locations",
"sites/$url/private",
"sites/$url/private/files",
"sites/$url/private/temp"
"sites/$url/private/temp",
"sites/$url/files/styles",
"sites/$url/files/private",
"sites/$url/private/config",
"sites/$url/private/config/active",
"sites/$url/private/config/staging"
);
// Allow other commands to add or alter the directories to be created.
drush_command_invoke_all_ref('provision_drupal_create_directories_alter', $mkdir, $url);
drush_command_invoke_all_ref('provision_drupal_chgrp_directories_alter', $chgrp, $url);
foreach ($mkdir as $path => $perm) {
if (!is_dir($path)) {
provision_file()->mkdir($path)
......@@ -283,15 +305,21 @@ function _provision_drupal_rebuild_caches() {
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
include_once('includes/install.inc');
if (!$dir = opendir("./profiles")) {
if (drush_drupal_major_version() >= 8) {
include_once('core/includes/install.inc');
$profiles_subdir = "./core/profiles";
}
else {
include_once('includes/install.inc');
$profiles_subdir = "./profiles";
}
if (!$dir = opendir($profiles_subdir)) {
drush_log(dt("Cannot find profiles directory"), 'error');
return FALSE;
}
while (FALSE !== ($name = readdir($dir))) {
$languages = array();
$file = "./profiles/$name/$name.profile";
$file = "$profiles_subdir/$name/$name.profile";
if ($name == '..' || $name == '.' || !file_exists($file)) {
continue;
}
......@@ -303,7 +331,7 @@ function _provision_find_profiles() {
$profile->info = array();
$info_file = "./profiles/$name/$name.info";
$info_file = "$profiles_subdir/$name/$name.info";
if (file_exists($info_file)) {
$profile->info = provision_parse_info_file($info_file);
// Skip hidden profiles
......@@ -320,8 +348,8 @@ function _provision_find_profiles() {
$languages['en'] = 1;
// Find languages available
$files = array_keys(drush_scan_directory('./profiles/' . $name . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory('./profiles/' . $name , '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
$files = array_keys(drush_scan_directory($profiles_subdir . '/' . $name . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory($profiles_subdir . '/' . $name , '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
......@@ -501,7 +529,7 @@ function _provision_find_platforms() {
return array(
'drupal' => array(
'short_name' => 'drupal', 'version' => drush_drupal_version(),
'description' => dt("This platform is running @short_name @version", array('@short_name' => 'Drupal', '@version' => VERSION))));
'description' => dt("This platform is running @short_name @version", array('@short_name' => 'Drupal', '@version' => drush_drupal_version()))));
}
/**
......@@ -599,6 +627,7 @@ function _provision_drupal_search_paths($scope, $key = '', $type = 'modules') {
switch ($scope) {
case 'base' :
$searchpaths[] = sprintf("%s/%s", $drupal_root, $type);
$searchpaths[] = sprintf("%s/core/%s", $drupal_root, $type);
break;
default :
if ($key) {
......
......@@ -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.
......
......@@ -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);
}
......
......@@ -76,7 +76,7 @@ function drush_provision_drupal_pre_provision_verify() {
->fail('Drupal sites directory @path is not writable by the provisioning script', 'PROVISION_SITES_DIR_NOT_WRITABLE');
drush_set_option('sites', array_keys((array) provision_drupal_find_sites()), 'drupal');
drush_log(dt("This platform is running @short_name @version", array('@short_name' => 'drupal', '@version' => VERSION)));
drush_log(dt("This platform is running @short_name @version", array('@short_name' => 'drupal', '@version' => drush_drupal_version())));
drush_set_option('packages', _scrub_object(provision_find_packages()), 'drupal');
provision_drupal_push_site();
}
......