Commit 77e93943 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by anarcat

bring http services into sync a bit.

parent c24b162c
...@@ -43,8 +43,8 @@ class provisionService_http_apache_ssl extends provisionService_http_ssl { ...@@ -43,8 +43,8 @@ class provisionService_http_apache_ssl extends provisionService_http_ssl {
* These config classes are a mix of the SSL and Non-SSL apache * These config classes are a mix of the SSL and Non-SSL apache
* classes. In some cases they extend the Apache classes too. * classes. In some cases they extend the Apache classes too.
*/ */
function init() { function init_server() {
parent::init(); parent::init_server();
// Replace the server config with our own. See the class for more info. // Replace the server config with our own. See the class for more info.
$this->configs['server'][] = 'provisionConfig_apache_ssl_server'; $this->configs['server'][] = 'provisionConfig_apache_ssl_server';
......
...@@ -11,39 +11,32 @@ class provisionService_http_nginx extends provisionService_http_public { ...@@ -11,39 +11,32 @@ class provisionService_http_nginx extends provisionService_http_public {
return provisionService_http_nginx::nginx_restart_cmd(); return provisionService_http_nginx::nginx_restart_cmd();
} }
function init() { function init_server() {
parent::init(); parent::init_server();
$this->configs['server'][] = 'provisionConfig_nginx_server'; $this->configs['server'][] = 'provisionConfig_nginx_server';
$this->configs['site'][] = 'provisionConfig_nginx_site'; $this->configs['site'][] = 'provisionConfig_nginx_site';
}
/** function save_server() {
* TODO: This is ugly, we need a different hook for save commands probably. // Check if some nginx features are supported and save them for later.
*/ $this->server->shell_exec('nginx -V');
$command = drush_get_command(); $this->server->nginx_has_gzip = preg_match("/(with-http_gzip_static_module)/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/(nginx-upload-progress-module)/", implode('', drush_shell_exec_output()), $match);
if ($command['command'] == 'provision-save') { $this->server->nginx_has_new_version = preg_match("/(nginx\/0\.8\.)/", implode('', drush_shell_exec_output()), $match);
// Check if some nginx features are supported and save them for later.
$this->server->shell_exec('/usr/sbin/nginx -V');
$this->server->nginx_has_gzip = preg_match("/with-http_gzip_static_module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_upload_progress = preg_match("/nginx-upload-progress-module/", implode('', drush_shell_exec_output()), $match);
$this->server->nginx_has_new_version = preg_match("/nginx\/0.8./", implode('', drush_shell_exec_output()), $match);
}
} }
function verify() { function verify_server_cmd() {
if ($this->context->type === 'server') { provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf');
provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf'); $this->sync($this->server->include_path . '/nginx_advanced_include.conf');
$this->sync($this->server->include_path . '/nginx_advanced_include.conf'); provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf');
provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf'); $this->sync($this->server->include_path . '/nginx_simple_include.conf');
$this->sync($this->server->include_path . '/nginx_simple_include.conf'); provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf');
provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf'); $this->sync($this->server->include_path . '/fastcgi_params.conf');
$this->sync($this->server->include_path . '/fastcgi_params.conf'); provision_file()->copy(dirname(__FILE__) . '/fastcgi_ssl_params.conf', $this->server->include_path . '/fastcgi_ssl_params.conf');
provision_file()->copy(dirname(__FILE__) . '/fastcgi_ssl_params.conf', $this->server->include_path . '/fastcgi_ssl_params.conf'); $this->sync($this->server->include_path . '/fastcgi_ssl_params.conf');
$this->sync($this->server->include_path . '/fastcgi_ssl_params.conf');
}
// Call the parent at the end. it will restart the server when it finishes. // Call the parent at the end. it will restart the server when it finishes.
parent::verify(); parent::verify_server_cmd();
} }
/** /**
......
...@@ -39,26 +39,24 @@ class provisionService_http_nginx_ssl extends provisionService_http_ssl { ...@@ -39,26 +39,24 @@ class provisionService_http_nginx_ssl extends provisionService_http_ssl {
* These config classes are a mix of the SSL and Non-SSL nginx * These config classes are a mix of the SSL and Non-SSL nginx
* classes. In some cases they extend the Nginx classes too. * classes. In some cases they extend the Nginx classes too.
*/ */
function init() { function init_server() {
parent::init(); parent::init_server();
// Replace the server config with our own. See the class for more info. // Replace the server config with our own. See the class for more info.
$this->configs['server'][] = 'provisionConfig_nginx_ssl_server'; $this->configs['server'][] = 'provisionConfig_nginx_ssl_server';
$this->configs['site'][] = 'provisionConfig_nginx_ssl_site'; $this->configs['site'][] = 'provisionConfig_nginx_ssl_site';
} }
function verify() { function verify_server_cmd() {
if ($this->context->type === 'server') { provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf');
provision_file()->copy(dirname(__FILE__) . '/nginx_advanced_include.conf', $this->server->include_path . '/nginx_advanced_include.conf'); $this->sync($this->server->include_path . '/nginx_advanced_include.conf');
$this->sync($this->server->include_path . '/nginx_advanced_include.conf'); provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf');
provision_file()->copy(dirname(__FILE__) . '/nginx_simple_include.conf', $this->server->include_path . '/nginx_simple_include.conf'); $this->sync($this->server->include_path . '/nginx_simple_include.conf');
$this->sync($this->server->include_path . '/nginx_simple_include.conf'); provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf');
provision_file()->copy(dirname(__FILE__) . '/fastcgi_params.conf', $this->server->include_path . '/fastcgi_params.conf'); $this->sync($this->server->include_path . '/fastcgi_params.conf');
$this->sync($this->server->include_path . '/fastcgi_params.conf'); provision_file()->copy(dirname(__FILE__) . '/fastcgi_ssl_params.conf', $this->server->include_path . '/fastcgi_ssl_params.conf');
provision_file()->copy(dirname(__FILE__) . '/fastcgi_ssl_params.conf', $this->server->include_path . '/fastcgi_ssl_params.conf'); $this->sync($this->server->include_path . '/fastcgi_ssl_params.conf');
$this->sync($this->server->include_path . '/fastcgi_ssl_params.conf');
}
// Call the parent at the end. it will restart the server when it finishes. // Call the parent at the end. it will restart the server when it finishes.
parent::verify(); parent::verify_server_cmd();
} }
/** /**
......
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