summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Drumm2010-06-08 05:22:03 (GMT)
committerNeil Drumm2010-06-08 05:22:03 (GMT)
commita62e7e39bf887f958f967196492fa4c677a01c64 (patch)
tree629e6405753c1a45b159853742a3952745911c1c
parent6e0d3d0eca22d8a95afe474c0935dd58f8ec24ff (diff)
Only sync the relevant sites directory.dev-services
-rw-r--r--file/file.drush.inc7
-rw-r--r--file/remote/remote_service.inc11
-rw-r--r--platform/provision_drupal.drush.inc9
-rw-r--r--provision.inc4
4 files changed, 25 insertions, 6 deletions
diff --git a/file/file.drush.inc b/file/file.drush.inc
index 8175334..545eca0 100644
--- a/file/file.drush.inc
+++ b/file/file.drush.inc
@@ -454,8 +454,13 @@ class provisionService_file extends provisionService {
/**
* 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)) {
$path = $this->config_path;
}
diff --git a/file/remote/remote_service.inc b/file/remote/remote_service.inc
index 886e011..3438d5d 100644
--- a/file/remote/remote_service.inc
+++ b/file/remote/remote_service.inc
@@ -1,16 +1,23 @@
<?php
+require_once DRUSH_BASE_PATH . '/commands/core/rsync.core.inc';
+
class provisionService_file_remote extends provisionService_file {
function init() {
$this->config_path = $this->config_path . '--' . $this->remote_host;
parent::init();
}
- function sync($path = NULL) {
+ function sync($path = NULL, $exclude_sites = FALSE) {
if (is_null($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)));
}
else {
diff --git a/platform/provision_drupal.drush.inc b/platform/provision_drupal.drush.inc
index 02c47b5..24bf18f 100644
--- a/platform/provision_drupal.drush.inc
+++ b/platform/provision_drupal.drush.inc
@@ -171,6 +171,13 @@ function _provision_drupal_site_installed() {
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.
*
@@ -183,7 +190,7 @@ function _provision_drupal_site_installed() {
function _provision_drupal_create_settings_file() {
$config = new provisionConfig_drupal_settings(d()->name);
$config->write();
- d()->service('file')->sync(d()->root);
+ provision_drupal_sync_site();
}
class provisionConfig_drupal_settings extends provisionConfig {
diff --git a/provision.inc b/provision.inc
index abb0cd7..b0ecae0 100644
--- a/provision.inc
+++ b/provision.inc
@@ -43,7 +43,7 @@ function provision_save_site_data() {
if (!drush_get_error()) {
$config = new provisionConfig_drushrc_site(d()->name);
$config->write();
- d()->service('file')->sync(d()->root);
+ provision_drupal_sync_site();
}
}
@@ -55,7 +55,7 @@ function provision_save_platform_data() {
if (!drush_get_error()) {
$config = new provisionConfig_drushrc_platform(d()->name);
$config->write();
- d()->service('file')->sync(d()->root);
+ provision_drupal_sync_site();
}
}