Commit a62e7e39 authored by drumm's avatar drumm Committed by Neil Drumm

Only sync the relevant sites directory.

parent 6e0d3d0e
...@@ -454,8 +454,13 @@ class provisionService_file extends provisionService { ...@@ -454,8 +454,13 @@ class provisionService_file extends provisionService {
/** /**
* If necessary, sync files out to a remote server. * If necessary, sync files out to a remote server.
*
* @param $path
* Full path to sync.
* @param $exclude_sites
* Exclude sites/*, except sites/*.
*/ */
function sync($path = NULL) { function sync($path = NULL, $exclude_sites = FALSE) {
if (is_null($path)) { if (is_null($path)) {
$path = $this->config_path; $path = $this->config_path;
} }
......
<?php <?php
require_once DRUSH_BASE_PATH . '/commands/core/rsync.core.inc';
class provisionService_file_remote extends provisionService_file { class provisionService_file_remote extends provisionService_file {
function init() { function init() {
$this->config_path = $this->config_path . '--' . $this->remote_host; $this->config_path = $this->config_path . '--' . $this->remote_host;
parent::init(); parent::init();
} }
function sync($path = NULL) { function sync($path = NULL, $exclude_sites = FALSE) {
if (is_null($path)) { if (is_null($path)) {
$path = $this->config_path; $path = $this->config_path;
} }
if (drush_shell_exec('rsync -azC --delete %s/ %s@%s:%s', $path, $this->script_user, $this->remote_host, $path)) {
$options = array(
'delete' => TRUE,
'exclude-sites' => $exclude_sites,
);
if (drush_core_call_rsync(escapeshellarg($path . '/'), escapeshellarg($this->script_user . '@' . $this->remote_host . ':' . $path), $options)) {
drush_log(dt('@path has been synced to remote server.', array('@path' => $path))); drush_log(dt('@path has been synced to remote server.', array('@path' => $path)));
} }
else { else {
......
...@@ -171,6 +171,13 @@ function _provision_drupal_site_installed() { ...@@ -171,6 +171,13 @@ function _provision_drupal_site_installed() {
return FALSE; return FALSE;
} }
function provision_drupal_sync_site() {
d()->service('file')->sync(d()->root, TRUE);
if (d()->type === 'site') {
d()->service('file')->sync(d()->root . '/sites/' . d()->uri);
}
}
/** /**
* Generate a settings file for the site. * Generate a settings file for the site.
* *
...@@ -183,7 +190,7 @@ function _provision_drupal_site_installed() { ...@@ -183,7 +190,7 @@ function _provision_drupal_site_installed() {
function _provision_drupal_create_settings_file() { function _provision_drupal_create_settings_file() {
$config = new provisionConfig_drupal_settings(d()->name); $config = new provisionConfig_drupal_settings(d()->name);
$config->write(); $config->write();
d()->service('file')->sync(d()->root); provision_drupal_sync_site();
} }
class provisionConfig_drupal_settings extends provisionConfig { class provisionConfig_drupal_settings extends provisionConfig {
......
...@@ -43,7 +43,7 @@ function provision_save_site_data() { ...@@ -43,7 +43,7 @@ function provision_save_site_data() {
if (!drush_get_error()) { if (!drush_get_error()) {
$config = new provisionConfig_drushrc_site(d()->name); $config = new provisionConfig_drushrc_site(d()->name);
$config->write(); $config->write();
d()->service('file')->sync(d()->root); provision_drupal_sync_site();
} }
} }
...@@ -55,7 +55,7 @@ function provision_save_platform_data() { ...@@ -55,7 +55,7 @@ function provision_save_platform_data() {
if (!drush_get_error()) { if (!drush_get_error()) {
$config = new provisionConfig_drushrc_platform(d()->name); $config = new provisionConfig_drushrc_platform(d()->name);
$config->write(); $config->write();
d()->service('file')->sync(d()->root); provision_drupal_sync_site();
} }
} }
......
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