Commit 304c5b5e authored by Adrian Rossouw's avatar Adrian Rossouw

testing out splitting up the http / apache stuff.

parent 5b7dc565
......@@ -72,6 +72,15 @@ class provisionService_db extends provisionService {
}
function verify() {
if (!$this->can_create_database()) {
drush_set_error('PROVISION_CREATE_DB_FAILED');
}
else {
drush_log(dt('Provision can create new databases.'), 'message');
}
}
/**
* Find a viable database name, based on available information.
*
......
......@@ -11,12 +11,7 @@ function drush_db_provision_verify_validate() {
*/
function drush_db_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) {
if (!provision_service('db')->can_create_database()) {
drush_set_error('PROVISION_CREATE_DB_FAILED');
}
else {
drush_log(dt('Mysql can create new databases.'), 'message');
}
provision_service('db')->verify();
}
}
......
<?php
include_once(dirname(__FILE__) . '/../provision.service.inc');
<?php
class provisionService_http_apache extends provisionService {
function templates() {
$this->configs['vhost'] = 'vhost.tpl.php';
$this->configs['vhost_redirect'] = 'vhost_redirect.tpl.php';
$this->configs['vhost_disabled'] = 'vhost_disabled.tpl.php';
$this->configs['platform'] = 'platform.tpl.php';
$this->configs['server'] = 'server.tpl.php';
}
function verify($url) {
if (PROVISION_CONTEXT_PLATFORM) {
_provision_create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
_provision_create_dir(drush_get_option('platform_conf_path'), dt("Platforms configuration"), 0700);
if (drush_get_option('platform', null)) {
$this->create_platform_config();
}
$this->create_server_config();
}
else {
$this->create_site_config($url);
}
$this->parse_configs();
}
function parse_configs($cause_error = FALSE) {
//This is required to be configurable, due to the fact that different hosts might need to do this differently.
//TODO : test for this instead of relying on a configuration setting?
$return = drush_shell_exec(escapeshellcmd(drush_get_option('restart_cmd')));
if (!$return) {
$msg = join("\n", drush_shell_exec_output());
if ($cause_error) {
return drush_set_error('PROVISION_WEB_RESTART_FAILED', dt("Web server could not be restarted. Changes might not be available until this has been done. (error: %msg)", array("%msg" => $msg)));
}
else {
drush_log(dt("Web server could not be restarted. Changes might not be available until this has been done. (error: %msg)", array("%msg" => $msg)), "warning");
}
}
else {
drush_log(dt('Apache has been restarted'));
}
return $return;
}
}
<?php
include_once(dirname(__FILE__) . '/../provision.service.inc');
function http_drush_init() {
}
class provisionService_http extends provisionService {
function parse_configs() {
}
function create_site_config($url) {
}
function delete_site_config($url) {
}
function create_platform_config($url) {
}
function delete_platform_config() {
}
function create_server_config() {
}
function delete_server_config() {
}
}
<?php
class provisionService {
protected $configs = array();
function verify() {
return TRUE;
}
function templates() {
$this->configs = array();
}
}
......
......@@ -247,27 +247,3 @@ function _provision_apache_delete_platform_config($file) {
}
/**
* Restart Apache
*/
function _provision_apache_restart_apache($cause_error = FALSE) {
//This is required to be configurable, due to the fact that different hosts might need to do this differently.
//TODO : test for this instead of relying on a configuration setting?
$return = drush_shell_exec(escapeshellcmd(drush_get_option('restart_cmd')));
if (!$return) {
$msg = join("\n", drush_shell_exec_output());
if ($cause_error) {
return drush_set_error('PROVISION_WEB_RESTART_FAILED', dt("Web server could not be restarted. Changes might not be available until this has been done. (error: %msg)", array("%msg" => $msg)));
}
else {
drush_log(dt("Web server could not be restarted. Changes might not be available until this has been done. (error: %msg)", array("%msg" => $msg)), "warning");
}
}
else {
drush_log(dt('Apache has been restarted'));
}
return $return;
}
<?php
function drush_provision_apache_provision_verify($url = null) {
if (PROVISION_CONTEXT_PLATFORM) {
_provision_create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
_provision_create_dir(drush_get_option('platform_conf_path'), dt("Platforms configuration"), 0700);
if (drush_get_option('platform', null)) {
_provision_apache_create_platform_config($url);
}
_provision_apache_create_server_config($url);
}
else {
_provision_apache_create_vhost_config($url);
}
_provision_apache_restart_apache(TRUE);
provision_service('http')->verify($url);
}
function drush_provision_apache_post_provision_verify($url = null) {
......
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