Commit 3b6f4a35 authored by drumm's avatar drumm Committed by Neil Drumm

Clean up site delete

parent 72471e28
......@@ -13,15 +13,28 @@ class provisionService_file_remote extends provisionService_file {
$path = $this->config_path;
}
if ($this->exists($path)->status()) {
$options = array(
'relative' => TRUE,
'delete' => TRUE,
'exclude-sites' => $exclude_sites,
);
if (drush_core_call_rsync(escapeshellarg($path . '/'), escapeshellarg($this->script_user . '@' . $this->remote_host . ':' . $path), $options)) {
if ($exclude_sites) {
$options['exclude-sites'] = TRUE;
}
if (drush_core_call_rsync(escapeshellarg($path), escapeshellarg($this->script_user . '@' . $this->remote_host . ':/'), $options)) {
drush_log(dt('@path has been synced to remote server.', array('@path' => $path)));
}
else {
drush_set_error('PROVISION_FILE_SYNC_FAILED', dt('Files could not be synced to remote server. Changes might not be available until this has been done. (error: %msg)', array('@path' => $path, '%msg' => join("\n", drush_shell_exec_output()))));
}
}
else { // File does not exist, remove it.
if ($this->server()->shell_exec('rm -rf ' . escapeshellarg($path))) {
drush_log(dt('@path has been removed from remote server.', array('@path' => $path)));
}
else {
drush_set_error('PROVISION_FILE_SYNC_FAILED', dt('Files could not be removed from remote server. Changes might not be available until this has been done. (error: %msg)', array('@path' => $path, '%msg' => join("\n", drush_shell_exec_output()))));
}
}
}
}
......@@ -21,12 +21,12 @@ class provisionService_http_apache extends provisionService_http {
function create_site_config() {
$config = new provisionConfig_apache_site($this->context, drush_get_context('site'));
return $config->write();
$config->write();
}
function delete_site_config() {
$config = new provisionConfig_apache_site($this->context);
return $config->unlink();
$config->unlink();
}
function create_platform_config() {
......@@ -36,7 +36,7 @@ class provisionService_http_apache extends provisionService_http {
function delete_platform_config() {
$config = new provisionConfig_apache_platform($this->context);
return $config->unlink();
$config->unlink();
}
function create_server_config() {
......@@ -47,7 +47,7 @@ class provisionService_http_apache extends provisionService_http {
function delete_server_config() {
$config = new provisionConfig_apache_server($this->context);
return $config->unlink();
$config->unlink();
}
function verify() {
......@@ -73,7 +73,6 @@ class provisionService_http_apache extends provisionService_http {
}
function parse_configs() {
d()->service('file')->sync();
// This is required to be configurable, due to the fact that different
// hosts might need to do this differently.
if (d()->service('http')->server()->shell_exec($this->restart_cmd)) {
......
......@@ -26,19 +26,19 @@ function drush_provision_drupal_pre_provision_delete($backup_file = NULL) {
function drush_provision_drupal_provision_delete() {
if (d()->type === 'site') {
_provision_recursive_delete(d()->root . '/sites/' . d()->uri);
d()->service('file')->sync(d()->root . '/sites/' . d()->uri);
// we remove the aliases even if redirection is enabled as a precaution
// if redirection is enabled, keep silent about errors
_provision_drupal_delete_aliases(drush_get_option('aliases', array(), 'site'), drush_get_option('redirection'));
drush_set_option('installed', FALSE, 'site');
}
if (d()->type === 'platform') {
$sites = provision_drupal_find_sites();
if($sites) {
if (provision_drupal_find_sites()) {
drush_set_error(dt('Existing sites were found on this platform. These sites will need to be deleted before this platform can be deleted.'));
}
else {
$drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
_provision_recursive_delete($drupal_root);
_provision_recursive_delete(d()->root);
d()->service('file')->sync(d()->root);
}
}
}
......
......@@ -113,12 +113,14 @@ class provisionConfig {
->succeed('Change group ownership of @path to @gid')
->fail('Could not change group ownership of @path to @gid');
}
d()->service('file')->sync($this->filename());
}
}
}
function unlink() {
return d()->service('file')->unlink($this->filename())->status();
d()->service('file')->unlink($this->filename())->status();
d()->service('file')->sync($this->filename());
}
}
......
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