Commit d9718351 authored by Jon Pugh's avatar Jon Pugh

Moving service loading to Context class... not quite ready! but...

parent 121044e6
......@@ -133,6 +133,15 @@ class Context
$this->services[strtolower($service_name)] = new $service_class($service, $this);
}
}
elseif (isset($this->config['service_subscriptions'])) {
foreach ($this->config['service_subscriptions'] as $service_name => $service) {
$this->servers[$service_name] = $server = $this->application->getContext($service['server']);
$service_type = ucfirst($server->services[$service_name]->type);
$service_name = ucfirst($service_name);
$service_class = "\\Aegir\\Provision\\Service\\{$service_name}\\{$service_name}{$service_type}Service";
$this->services[strtolower($service_name)] = new $service_class($service, $this);
}
}
else {
$this->services = [];
}
......@@ -413,7 +422,16 @@ class Context
return '\Aegir\Provision\Context\\' . ucfirst($type) . "Context";
}
// public function verify() {
// return "Provision Context";
// }
public function verify() {
return "Provision Context";
// Run verify method on all services.
foreach ($this->getServices() as $service) {
$service->verify();
}
}
}
......@@ -64,7 +64,7 @@ class PlatformContext extends Context implements ConfigurationInterface
public function verify() {
parent::verify();
$this->logger->info('Verifying Web Server...');
$this->web_server->verify();
return "Platform Context Verified: " . $this->name;
}
}
......@@ -36,14 +36,4 @@ class ServerContext extends Context implements ConfigurationInterface
return $options;
}
public function verify() {
// Run verify method on all services.
foreach ($this->getServices() as $service) {
$service->verify();
}
return "Server Context Verified: " . $this->name;
}
}
......@@ -63,12 +63,11 @@ class SiteContext extends Context implements ConfigurationInterface
public function verify() {
parent::verify();
$this->db_server->verify();
$this->platform->verify();
// @TODO: Write VHOST!
// $this->db_server->service('db')->verify();
// $this->platform->verify();
return "Site Context Verified: " . $this->name;
// return "Site Context Verified: " . $this->name;
}
// /**
......
......@@ -35,6 +35,7 @@ class Service {
if (empty($this->getConfigurations()[$this->context->type])) {
return;
}
$this->context->application->logger->info('CONTEXT ' . $this->context->type);
foreach ($this->getConfigurations()[$this->context->type] as $configuration_class) {
$config = new $configuration_class($this->context, $this);
$config->write();
......
......@@ -22,12 +22,18 @@ class SiteConfiguration extends Configuration {
function filename() {
if (drush_get_option('provision_apache_conf_suffix', FALSE)) {
return $this->data['http_vhostd_path'] . '/' . $this->uri . '.conf';
}
else {
return $this->data['http_vhostd_path'] . '/' . $this->uri;
}
$file = $this->uri . '.conf';
// return $this->service->properties['http_platformd_path'] . '/' . ltrim($this->context->name, '@') . '.conf';
return $this->context->console_config['config_path'] . '/' . $this->context->name . '/' . $file;
// return $this->context->config['config_path'];
// if (drush_get_option('provision_apache_conf_suffix', FALSE)) {
// return $this->data['http_vhostd_path'] . '/' . $this->uri . '.conf';
// }
// else {
// return $this->data['http_vhostd_path'] . '/' . $this->uri;
// }
}
function process() {
......
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