Commit d666459c authored by Adrian Rossouw's avatar Adrian Rossouw

Fix generation of config files so they happen per server. SLightly less magic in the config class.

parent 41c161c9
......@@ -19,29 +19,41 @@ class provisionService_http_apache extends provisionService_http {
$this->server->setProperty('web_ports', array(80));
}
/**
* Pass some extra paths to the config file classes, which specify the server relative paths
* for use in the filename() methods.
*/
function config_data() {
return array(
'apache_site_conf_path' => $this->server->apache_site_conf_path,
'apache_platform_conf_path' => $this->server->apache_platform_conf_path,
'apache_conf_path' => $this->server->apache_conf_path
);
}
function create_site_config() {
if (d($this->context)->site_enabled) {
$config = new provisionConfig_apache_site($this->context, drush_get_context('site'));
$config = new provisionConfig_apache_site($this->context, $this->config_data() + drush_get_context('site'));
}
else {
$config = new provisionConfig_apache_site_disabled($this->context, drush_get_context('site'));
$config = new provisionConfig_apache_site_disabled($this->context, $this->config_data() + drush_get_context('site'));
}
$config->write();
}
function delete_site_config() {
$config = new provisionConfig_apache_site($this->context);
$config = new provisionConfig_apache_site($this->context, $this->config_data());
$config->unlink();
}
function create_platform_config() {
$config = new provisionConfig_apache_platform($this->context);
$config = new provisionConfig_apache_platform($this->context, $this->config_data());
return $config->write();
}
function delete_platform_config() {
$config = new provisionConfig_apache_platform($this->context);
$config = new provisionConfig_apache_platform($this->context, $this->config_data());
$config->unlink();
}
......@@ -51,12 +63,12 @@ class provisionService_http_apache extends provisionService_http {
provision_file()->create_dir($this->server->apache_conf_path , dt("Apache configuration"), 0700);
$this->sync($this->server->apache_conf_path);
$config = new provisionConfig_apache_server($this->context);
$config = new provisionConfig_apache_server($this->context, $this->config_data());
return $config->write();
}
function delete_server_config() {
$config = new provisionConfig_apache_server($this->context);
$config = new provisionConfig_apache_server($this->context, $this->config_data());
$config->unlink();
}
......@@ -76,7 +88,6 @@ class provisionConfig_apache extends provisionConfig {
}
/**
* Apache server level configuration file class
*/
......@@ -102,7 +113,7 @@ class provisionConfig_apache_platform extends provisionConfig_apache {
public $description = 'apache platform configuration file';
function filename() {
return $this->apache_platform_conf_path . '/' . ltrim(d()->name, '@') . '.conf';
return $this->data['apache_platform_conf_path'] . '/' . ltrim($this->owner->name, '@') . '.conf';
}
function process() {
......@@ -119,7 +130,7 @@ class provisionConfig_apache_site extends provisionConfig_apache {
public $description = 'apache site configuration file';
function filename() {
return $this->apache_site_conf_path . '/' . $this->uri . '_' . $this->site_port;
return $this->data['apache_site_conf_path'] . '/' . $this->uri . '_' . $this->site_port;
}
function process() {
......
<Directory <?php print d()->root; ?>>
<Directory <?php print $this->root; ?>>
Order allow,deny
Allow from all
<?php print $extra_config; ?>
......
# Aegir web server configuration file
<?php if (is_array(d()->web_ports)) :
foreach (d()->web_ports as $web_port) :?>
<?php if (is_array($this->web_ports)) :
foreach ($this->web_ports as $web_port) :?>
NameVirtualHost *:<?php print $web_port; ?>
<VirtualHost *:<?php print $web_port; ?>>
......
......@@ -7,7 +7,6 @@ function http_provision_services() {
return array('http' => NULL);
}
class provisionService_http extends provisionService {
static function option_documentation() {
return array(
......
......@@ -16,8 +16,8 @@ class provisionConfig {
protected $group = NULL;
function __get($name) {
if ($this->owner) {
return d($this->owner)->$name;
if (isset($this->owner)) {
return $this->owner->$name;
}
}
......@@ -28,11 +28,7 @@ class provisionConfig {
if (sizeof($data)) {
$this->data = $data;
}
$this->owner = $owner;
}
function owner() {
return d($this->owner);
$this->owner = d($owner);
}
/**
......
......@@ -9,7 +9,6 @@ class provisionService extends provisionChainedState {
protected $server = '@server_localhost';
public $context;
function __construct($server) {
$this->server = d($server);
}
......
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