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

Get a bit of remote web server config files working properly

parent 3cc97e55
......@@ -16,8 +16,7 @@ function file_provision_services() {
}
function file_drush_exit() {
// todo sync out to other servers
//provision_service('file')->sync();
d()->service('file')->sync();
}
class provisionService_file extends provisionService {
......@@ -456,4 +455,10 @@ class provisionService_file extends provisionService {
function _chgrp_recursive($path, $group) {
return $this->_call_recursive('chgrp', $path, $group);
}
/**
* If necessary, sync files out to a remote server.
*/
function sync() {
}
}
<?php
class provisionService_file_remote extends provisionService_file {
function init() {
$this->remote_config_path = $this->config_path;
$this->config_path = $this->config_path . '--' . $this->remote_host;
parent::init();
}
function sync() {
if (!drush_shell_exec('rsync -azC --delete %s/ %s@%s:%s', $this->config_path, d()->script_user, d()->remote_host, $this->remote_config_path)) {
return 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("%msg" => join("\n", drush_shell_exec_output()))));
}
else {
drush_log(dt('Files have been synced to remote server.'));
}
}
}
......@@ -54,9 +54,9 @@ class provisionService_http_apache extends provisionService_http {
function verify() {
switch (d()->type) {
case 'server':
provision_service('file')->create_dir($this->apache_site_conf_path, dt("Virtual host configuration"), 0700);
provision_service('file')->create_dir($this->apache_platform_conf_path, dt("Platforms configuration"), 0700);
provision_service('file')->create_dir($this->apache_conf_path , dt("Apache configuration"), 0700);
d()->service('file')->create_dir($this->apache_site_conf_path, dt("Virtual host configuration"), 0700);
d()->service('file')->create_dir($this->apache_platform_conf_path, dt("Platforms configuration"), 0700);
d()->service('file')->create_dir($this->apache_conf_path , dt("Apache configuration"), 0700);
$this->create_server_config();
break;
......@@ -70,6 +70,7 @@ class provisionService_http_apache extends provisionService_http {
break;
}
d()->service('file')->sync();
$this->parse_configs();
}
......
......@@ -245,6 +245,14 @@ class provisionServer extends provisionEnvironment {
$type_option = "{$service}_service_type";
$type = isset($this->options[$type_option]) ? $this->options[$type_option] : $default;
if ($service === 'file') {
// Force provision-save local
$command = drush_get_command();
$command = explode(" ", $command['command']);
if (preg_match("/^provision-save/", $command[0])) {
$type = 'local';
}
}
if ($type) {
$file = sprintf("%s/%s/%s_service.inc", $base_dir, $type, $type);
$className = sprintf("provisionService_%s_%s", $service, $type);
......
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