Commit 6a516478 authored by omega8cc's avatar omega8cc

Restore BOA features and settings.

parent ce66c80f
# Ignore paths from OS X
.DS_Store
build-area
GPATH
GRTAGS
......
......@@ -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';
......@@ -42,5 +47,29 @@ class Provision_Config_Drupal_Settings extends Provision_Config {
// then react to this and change any settings we don't want backed up.
$backup_file = drush_get_option('backup_file');
$this->backup_in_progress = !empty($backup_file);
// Create a blank local.settings.php file if not exists.
$local_settings = $this->site_path . '/local.settings.php';
$local_settings_blank = "<?php # local settings.php \n";
$local_description = 'Drupal local.settings.php file';
if (!provision_file()->exists($local_settings)->status()) {
provision_file()->file_put_contents($local_settings, $local_settings_blank)
->succeed('Generated blank ' . $local_description)
->fail('Could not generate ' . $local_description);
provision_file()->chgrp($local_settings, $this->group)
->succeed('Changed group ownership of <code>@path</code> to @gid')
->fail('Could not change group ownership of <code>@path</code> to @gid');
provision_file()->chmod($local_settings, $this->mode | 0440)
->succeed('Changed permissions of <code>@path</code> to @perm')
->fail('Could not change permissions of <code>@path</code> to @perm');
}
else {
provision_file()->chgrp($local_settings, $this->group)
->succeed('Changed group ownership of <code>@path</code> to @gid')
->fail('Could not change group ownership of <code>@path</code> to @gid');
provision_file()->chmod($local_settings, $this->mode | 0440)
->succeed('Changed permissions of <code>@path</code> to @perm')
->fail('Could not change permissions of <code>@path</code> to @perm');
}
}
}
......@@ -109,11 +109,9 @@ if (isset($_SERVER['db_name'])) {
@ini_set('arg_separator.output', '&amp;');
@ini_set('magic_quotes_runtime', 0);
@ini_set('magic_quotes_sybase', 0);
@ini_set('session.cache_expire', 200000);
@ini_set('session.cache_limiter', 'none');
@ini_set('session.cookie_lifetime', 0);
@ini_set('session.gc_maxlifetime', 200000);
@ini_set('session.save_handler', 'user');
@ini_set('session.use_cookies', 1);
@ini_set('session.use_only_cookies', 1);
@ini_set('session.use_trans_sid', 0);
@ini_set('url_rewriter.tags', '');
......@@ -128,18 +126,29 @@ if (isset($_SERVER['db_name'])) {
$conf['install_profile'] = '<?php print $this->profile ?>';
$conf['<?php print $file_directory_path_var ?>'] = 'sites/<?php print $this->uri ?>/files';
$conf['<?php print $file_directory_temp_var ?>'] = 'sites/<?php print $this->uri ?>/private/temp';
<?php if (isset($file_directory_private_var)): ?>
<?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 ?>;
<?php if (!$this->site_enabled) : ?>
<?php if (!$this->site_enabled) : ?>
// This is for Drupal 6 and below.
$conf['site_offline'] = 1;
// And this is for Drupal 7 and above.
$conf['maintenance_mode'] = 1;
<?php endif ?>
<?php endif ?>
<?php print $extra_config; ?>
......
aegir-dev.make
\ No newline at end of file
core = 6.x
api = 2
; BOA-2.3.x-dev
projects[pressflow][type] = "core"
projects[pressflow][download][type] = "get"
projects[pressflow][download][url] = "http://files.aegir.cc/core/pressflow-6.33.1.tar.gz"
projects[hostmaster][type] = "profile"
projects[hostmaster][download][type] = "git"
projects[hostmaster][download][url] = "https://github.com/omega8cc/hostmaster.git"
projects[hostmaster][download][branch] = "2.3.x-profile"
......@@ -56,6 +56,11 @@ class Provision_Service_db_mysql extends Provision_Service_db_pdo {
function grant($name, $username, $password, $host = '') {
$host = ($host) ? $host : '%';
if ($host != "127.0.0.1") {
$extra_host = "127.0.0.1";
$success_extra_host = $this->query("GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@`%s` IDENTIFIED BY '%s'", $name, $username, $extra_host, $password);
}
// Issue: https://github.com/omega8cc/provision/issues/2
return $this->query("GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@`%s` IDENTIFIED BY '%s'", $name, $username, $host, $password);
}
......@@ -79,6 +84,29 @@ class Provision_Service_db_mysql extends Provision_Service_db_pdo {
if (!$grant_found) {
$success = $this->query("DROP USER `%s`@`%s`", $username, $host) && $success;
}
if ($host != "127.0.0.1") {
$extra_host = "127.0.0.1";
$success_extra_host = $this->query("REVOKE ALL PRIVILEGES ON `%s`.* FROM `%s`@`%s`", $name, $username, $extra_host);
// check if there are any privileges left for the user
$grants = $this->query("SHOW GRANTS FOR `%s`@`%s`", $username, $extra_host);
$grant_found = FALSE;
if ($grants) {
while ($grant = $grants->fetch()) {
// those are empty grants: just the user line
if (!preg_match("/^GRANT USAGE ON /", array_pop($grant))) {
// real grant, we shouldn't remove the user
$grant_found = TRUE;
break;
}
}
}
if (!$grant_found) {
$success_extra_host = $this->query("DROP USER `%s`@`%s`", $username, $extra_host) && $success_extra_host;
}
}
return $success;
}
......@@ -120,7 +148,7 @@ class Provision_Service_db_mysql extends Provision_Service_db_pdo {
// non-readable by the webserver.
umask(0077);
// Mixed copy-paste of drush_shell_exec and provision_shell_exec.
$cmd = sprintf("mysqldump --defaults-file=/dev/fd/3 --single-transaction --quick %s | sed 's|/\\*!50001 CREATE ALGORITHM=UNDEFINED \\*/|/\\*!50001 CREATE \\*/|g; s|/\\*!50017 DEFINER=`[^`]*`@`[^`]*`\s*\\*/||g' | sed '/\\*!50013 DEFINER=.*/ d' > %s/database.sql", escapeshellcmd(drush_get_option('db_name')), escapeshellcmd(d()->site_path));
$cmd = sprintf("mysqldump --defaults-file=/dev/fd/3 --opt --skip-lock-tables --order-by-primary --default-character-set=utf8 -Q --hex-blob --single-transaction --quick %s | sed 's|/\\*!50001 CREATE ALGORITHM=UNDEFINED \\*/|/\\*!50001 CREATE \\*/|g; s|/\\*!50017 DEFINER=`[^`]*`@`[^`]*`\s*\\*/||g' | sed '/\\*!50013 DEFINER=.*/ d' > %s/database.sql", escapeshellcmd(drush_get_option('db_name')), escapeshellcmd(d()->site_path));
$success = $this->safe_shell_exec($cmd, drush_get_option('db_host'), urldecode(drush_get_option('db_user')), urldecode(drush_get_option('db_passwd')));
$dump_size_too_small = filesize(d()->site_path . '/database.sql') < 1024;
......
......@@ -45,7 +45,7 @@ Description: mass Drupal hosting system - frontend
.
This package provides the frontend web interface that users generally
interact with. It's made up of a regular Drupal site with a custom
install profile, module and theme.
installation profile, module and theme.
.
This meta-package will dynamically install the frontend using drush
and provision and as such doesn't bundle any files itself. Everything
......
......@@ -10,6 +10,7 @@ server {
<?php endforeach; ?>
server_name _;
location / {
return 404;
root /var/www/nginx-default;
index index.html index.htm;
}
}
......@@ -4,6 +4,8 @@
server {
listen <?php print "{$ip_address}:{$http_ssl_port}"; ?>;
server_name <?php print $this->uri . ' ' . implode(' ', $this->aliases); ?>;
root /var/www/nginx-default;
index index.html index.htm;
ssl on;
ssl_certificate <?php print $ssl_cert; ?>;
ssl_certificate_key <?php print $ssl_cert_key; ?>;
......@@ -11,7 +13,6 @@ server {
ssl_ciphers RC4:HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
keepalive_timeout 70;
return 404;
### Do not reveal Aegir front-end URL here.
}
......
......@@ -5,6 +5,11 @@
#######################################################
<?php
$nginx_config_mode = drush_get_option('nginx_config_mode');
if (!$nginx_config_mode && $server->nginx_config_mode) {
$nginx_config_mode = $server->nginx_config_mode;
}
$nginx_is_modern = drush_get_option('nginx_is_modern');
if (!$nginx_is_modern && $server->nginx_is_modern) {
$nginx_is_modern = $server->nginx_is_modern;
......@@ -15,49 +20,86 @@ if (!$nginx_has_gzip && $server->nginx_has_gzip) {
$nginx_has_gzip = $server->nginx_has_gzip;
}
$nginx_config_mode = drush_get_option('nginx_config_mode');
if (!$nginx_config_mode && $server->nginx_config_mode) {
$nginx_config_mode = $server->nginx_config_mode;
$nginx_has_upload_progress = drush_get_option('nginx_has_upload_progress');
if (!$nginx_has_upload_progress && $server->nginx_has_upload_progress) {
$nginx_has_upload_progress = $server->nginx_has_upload_progress;
}
if ($nginx_is_modern) {
print " limit_conn_zone \$binary_remote_addr zone=gulag:10m;\n";
print " limit_conn_zone \$binary_remote_addr zone=limreq:10m;\n";
}
else {
print " limit_zone gulag \$binary_remote_addr 10m;\n";
print " limit_zone limreq \$binary_remote_addr 10m;\n";
}
if ($nginx_has_gzip) {
print " gzip_static on;\n";
}
if ($nginx_has_upload_progress) {
print " upload_progress uploads 1m;\n";
}
?>
<?php if ($nginx_config_mode == 'extended'): ?>
## FastCGI params
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE ApacheSolarisNginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param USER_DEVICE $device;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_index index.php;
## Default index files
index index.php index.html;
## Size Limits
client_body_buffer_size 64k;
client_header_buffer_size 32k;
large_client_header_buffers 32 32k;
client_max_body_size 100m;
connection_pool_size 256;
request_pool_size 4k;
server_names_hash_bucket_size 512;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
large_client_header_buffers 32 32k;
map_hash_bucket_size 192;
request_pool_size 4k;
server_names_hash_bucket_size 512;
server_names_hash_max_size 8192;
types_hash_bucket_size 512;
variables_hash_max_size 1024;
## Timeouts
client_body_timeout 60;
client_header_timeout 60;
send_timeout 60;
client_body_timeout 180;
client_header_timeout 180;
send_timeout 180;
lingering_time 30;
lingering_timeout 5;
fastcgi_connect_timeout 60;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_connect_timeout 10s;
fastcgi_send_timeout 180s;
fastcgi_read_timeout 180s;
## Open File Performance
open_file_cache max=8000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_valid 99s;
open_file_cache_min_uses 3;
open_file_cache_errors on;
......@@ -73,19 +115,47 @@ if ($nginx_has_gzip) {
recursive_error_pages on;
reset_timedout_connection on;
fastcgi_intercept_errors on;
server_tokens off;
fastcgi_hide_header 'Link';
fastcgi_hide_header 'X-Generator';
fastcgi_hide_header 'X-Powered-By';
fastcgi_hide_header 'X-Drupal-Cache';
## Compression
gzip_buffers 16 8k;
gzip_comp_level 5;
gzip_http_version 1.1;
gzip_min_length 10;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
gzip_proxied any;
## TCP options moved to /etc/nginx/nginx.conf
## SSL performance
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
## GeoIP support
geoip_country /usr/share/GeoIP/GeoIP.dat;
## Compression
gzip_buffers 16 8k;
gzip_comp_level 8;
gzip_http_version 1.0;
gzip_min_length 50;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-opentype
application/x-font-ttf
application/x-javascript
application/xhtml+xml
application/xml
application/xml+rss
font/opentype
image/svg+xml
image/x-icon
text/css
text/javascript
text/plain
text/xml;
gzip_vary on;
gzip_proxied any;
<?php endif; ?>
## Default index files
......@@ -102,6 +172,8 @@ if ($nginx_has_gzip) {
<?php print $extra_config; ?>
<?php if ($nginx_config_mode == 'extended'): ?>
error_log /var/log/nginx/error.log crit;
#######################################################
### nginx default maps
#######################################################
......@@ -137,15 +209,23 @@ map $request_uri $key_uri {
###
map $http_user_agent $is_crawler {
default '';
~*HTTrack|BrokenLinkCheck|2009042316.*Firefox.*3\.0\.10|MJ12|HTMLParser|PECL|Automatic|SiteBot|BuzzTrack|Sistrix|Offline|Screaming|Nutch|Mireo|SWEB|Morfeus|GSLFbot is_crawler;
~*HTTrack|BrokenLinkCheck|2009042316.*Firefox.*3\.0\.10|MJ12|HTMLParser|PECL|Automatic|SiteBot|BuzzTrack|Sistrix|Offline|Nutch|Mireo|SWEB|Morfeus|GSLFbot|HiScan|Riddler|DBot|CCBot is_crawler;
}
###
### Deny all known bots on some URIs.
### Deny all known bots/spiders on some URIs.
###
map $http_user_agent $is_bot {
default '';
~*crawl|goog|yahoo|yandex|spider|bot|tracker|click|parser is_bot;
~*crawl|bot|spider|tracker|click|parser|google|yahoo|yandex|baidu|bing is_bot;
}
###
### Deny almost all crawlers under high load.
###
map $http_user_agent $deny_on_high_load {
default '';
~*crawl|spider|tracker|click|parser|google|yahoo|yandex|baidu|bing deny_on_high_load;
}
###
......@@ -161,11 +241,48 @@ map $args $is_denied {
### nginx default server
#######################################################
<?php
$ip_address = !empty($ip_address) ? $ip_address : '*';
?>
server {
listen *:<?php print $http_port; ?>;
<?php
if ($ip_address == '*') {
print " listen {$ip_address}:{$http_port};\n";
}
else {
foreach ($server->ip_addresses as $ip) {
print " listen {$ip}:{$http_port};\n";
}
}
?>
server_name _;
location / {
return 404;
expires 99s;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
add_header Access-Control-Allow-Origin *;
root /var/www/nginx-default;
index index.html index.htm;
}
}
server {
<?php
if ($ip_address == '*') {
print " listen {$ip_address}:{$http_port};\n";
}
else {
foreach ($server->ip_addresses as $ip) {
print " listen {$ip}:{$http_port};\n";
}
print " listen 127.0.0.1:{$http_port};\n";
}
?>
server_name 127.0.0.1;
location /nginx_status {
stub_status on;
access_log off;
allow 127.0.0.1;
deny all;
}
}
......
location ^~ /<?php print $subdir; ?>/ {
return 404;
root /var/www/nginx-default;
index index.html index.htm;
### Do not reveal Aegir front-end URL here.
}
<?php
$ip_address = !empty($ip_address) ? $ip_address : '*';
?>
server {
listen *:<?php print $http_port; ?>;
<?php
if ($ip_address == '*') {
print " listen {$ip_address}:{$http_port};\n";
}
else {
foreach ($server->ip_addresses as $ip) {
print " listen {$ip}:{$http_port};\n";
}
}
?>
server_name <?php print $this->uri . ' ' . implode(' ', $this->aliases); ?>;
return 404;
root /var/www/nginx-default;
index index.html index.htm;
### Do not reveal Aegir front-end URL here.
}
......@@ -20,6 +20,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
$this->server->setProperty('nginx_config_mode', 'extended');
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('nginx_has_upload_progress', FALSE);
$this->server->setProperty('provision_db_cloaking', TRUE);
$this->server->setProperty('phpfpm_mode', 'port');
if (subdirs_drush_load()) {
......@@ -45,6 +46,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
// Use basic nginx configuration if this control file exists.
......@@ -86,6 +88,7 @@ class Provision_Service_http_nginx extends Provision_Service_http_public {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
// Use basic nginx configuration if this control file exists.
......
......@@ -39,6 +39,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
$this->server->setProperty('nginx_config_mode', 'extended');
$this->server->setProperty('nginx_is_modern', FALSE);
$this->server->setProperty('nginx_has_gzip', FALSE);
$this->server->setProperty('nginx_has_upload_progress', FALSE);
$this->server->setProperty('provision_db_cloaking', TRUE);
$this->server->setProperty('phpfpm_mode', 'port');
}
......@@ -60,6 +61,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
// Use basic nginx configuration if this control file exists.
......@@ -101,6 +103,7 @@ class Provision_Service_http_nginx_ssl extends Provision_Service_http_ssl {
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec($path . ' -V');
$this->server->nginx_is_modern = preg_match("/nginx\/1\.((1\.(8|9|(1[0-9]+)))|((2|3|4|5|6|7|8|9)\.))/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/upload/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_gzip = preg_match("/http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
// Use basic nginx configuration if this control file exists.
......
......@@ -20,6 +20,19 @@ class Provision_Service_http_public extends Provision_Service_http {
$data['http_port'] = $this->server->http_port;
// We assign this generic catch all for standard http.
// The SSL based services will override this with the
// correct ip address.
if (sizeof($this->server->ip_addresses)) {
// Use the first IP address for all standard virtual hosts.
$data['ip_address'] = $this->server->ip_addresses[0];
}
else {
// If no external ip addresses are defined, we fall back on *:port
// There will be no SSL , so that's fine.
$data['ip_address'] = '*';
}
// TODO: move away from drush_get_context entirely.
if ($config == 'site') {
......
......@@ -162,5 +162,8 @@ function drush_provision_post_hostmaster_migrate($site, $platform) {
'old_platform_name' => drush_get_option('old_platform'),
'new_platform_name' => drush_get_option('new_platform'),
));
// We need to re-verify @server_master via frontend to re-generate
// its drush alias and to update Nginx configuration files.
provision_backend_invoke('@hostmaster', 'hosting-task', array(@server_master, 'verify'), array('force' => TRUE));
}
......@@ -38,6 +38,19 @@ function drush_provision_drupal_pre_provision_clone_rollback($new_uri, $platform
function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
drush_set_option('old_platform', d()->platform->name);
// If the site is cloned between platforms and not just in the same platform,
// we should update the info collected about source and target platform first.
if (!is_null(d($platform)->name) && (d($platform)->name != d()->platform->name)) {
provision_backend_invoke('@hostmaster', 'hosting-task', array(d()->platform->name, 'verify'), array('force' => TRUE));
sleep(5); // A small trick to avoid high load and race conditions.
provision_backend_invoke('@hostmaster', 'hosting-task', array(d($platform)->name, 'verify'), array('force' => TRUE));
sleep(5); // A small trick to avoid high load and race conditions.
}
// We should update also the info collected about the site before running clone.
$local_uri_verify = '@' . d()->uri;
provision_backend_invoke('@hostmaster', 'hosting-task', array($local_uri_verify, 'verify'), array('force' => TRUE));
sleep(5); // A small trick to avoid high load and race conditions.
$options = d()->options;
$options['uri'] = ltrim($new_uri, '@');
$hash_name = drush_get_option('#name') ? '#name' : 'name';
......@@ -54,6 +67,10 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
$options['ssl_enabled'] = 0;
unset($options['ssl_key']);
// Do not copy CDN aliases to the cloned site --CDN vhost
$options['cdn'] = 0;
unset($options['cdn']);
if ($profile = drush_get_option('profile', FALSE)) {
$options['profile'] = $profile;
}
......@@ -68,7 +85,11 @@ function drush_provision_drupal_provision_clone($new_uri, $platform = null) {
provision_backend_invoke($new_uri, 'provision-deploy', array(drush_get_option('backup_file')), array('old_uri' => d()->uri));
if (!drush_get_error()) {
// Verify the newly cloned site.
provision_backend_invoke($new_uri, 'provision-verify');
sleep(5); // A small trick to avoid high load and race conditions.
// Verify again also original site via frontend to avoid issue #1004526
provision_backend_invoke('@hostmaster', 'hosting-task', array($local_uri_verify, 'verify'), array('force' => TRUE));
}
provision_reload_config('site', d()->site_path . '/drushrc.php');
......
......@@ -4,8 +4,40 @@
* Rebuild all the caches
*/
module_list(TRUE, FALSE);
module_rebuild_cache();
drush_log(dt('Rebuilt module cache'));
cache_clear_all('*', 'cache_form', TRUE); // This bin is excluded in drupal_flush_all_caches()
// but if not purged, it may break tasks with
// mysterious errors thanks to garbage collected.
drupal_flush_all_caches();
drush_log(dt('All caches flushed'));
// function drupal_flush_all_caches() {
// // Change query-strings on css/js files to enforce reload for all users.
// _drupal_flush_css_js();
//
// drupal_clear_css_cache();
// drupal_clear_js_cache();
//
// // If invoked from update.php, we must not update the theme information in the
// // database, or this will result in all themes being disabled.
// if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') {
// _system_theme_data();
// }
// else {
// system_theme_data();
// }
//
// drupal_rebuild_theme_registry();
// menu_rebuild();
// node_types_rebuild();
// // Don't clear cache_form - in-progress form submissions may break.
// // Ordered so clearing the page cache will always be the last action.
// $core = array('cache', 'cache_block', 'cache_filter', 'cache_page');
// $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
// foreach ($cache_tables as $table) {
// cache_clear_all('*', $table, TRUE);
// }
// }
......@@ -4,5 +4,50 @@
* Rebuild all the caches
*/
cache_clear_all('*', 'cache_form', TRUE); // This bin is excluded in drupal_flush_all_caches()
// but if not purged, it may break tasks with
// mysterious errors thanks to garbage collected.
drupal_flush_all_caches();
drush_log(dt('All caches flushed'));
// function drupal_flush_all_caches() {
// // Change query-strings on css/js files to enforce reload for all users.
// _drupal_flush_css_js();
//
// registry_rebuild();
// drupal_clear_css_cache();
// drupal_clear_js_cache();
//
// // Rebuild the theme data. Note that the module data is rebuilt above, as
// // part of registry_rebuild().
// system_rebuild_theme_data();
// drupal_theme_rebuild();
//
// entity_info_cache_clear();
// node_types_rebuild();
// // node_menu() defines menu items based on node types so it needs to come
// // after node types are rebuilt.
// menu_rebuild();
//
// // Synchronize to catch any actions that were added or removed.
// actions_synchronize();
//
// // Don't clear cache_form - in-progress form submissions may break.
// // Ordered so clearing the page cache will always be the last action.
// $core = array(
// 'cache',
// 'cache_path',
// 'cache_filter',
// 'cache_bootstrap',
// 'cache_page',
// );
// $cache_tables = array_merge(module_invoke_all('flush_caches'), $core);
// foreach ($cache_tables as $table) {
// cache_clear_all('*', $table, TRUE);
// }
//
// // Rebuild the bootstrap module list. We do this here so that developers
// // can get new hook_boot() implementations registered without having to
// // write a hook_update_N() function.
// _system_update_bootstrap_status();
// }
......@@ -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');
}
......@@ -231,6 +231,7 @@ function install_main() {
db_query("INSERT INTO {system} (filename, name, type, owner, status, throttle, bootstrap, schema_version) VALUES('%s', '%s', '%s', '%s', %d, %d, %d, %d)", $system_path .'/system.module', 'system', 'module', '', 1, 0, 0, $system_version);
// Now that we've installed things properly, bootstrap the full Drupal environment
module_list(TRUE, FALSE);
module_rebuild_cache();
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL);
$modules = array_diff($modules, array('system'));
......@@ -296,6 +297,7 @@ function install_main() {
if (function_exists($function)) {
while (!in_array($task, array('profile-finished', 'finished'))) {
drush_log(dt("Running profile specific task : !task", array('!task' => $task)));
module_list(TRUE, FALSE);
module_rebuild_cache();
module_load_all();
// stop batch api from re-directing. ever.
...