summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Pugh2017-10-25 20:07:55 (GMT)
committerJon Pugh2017-10-25 20:07:55 (GMT)
commit5f540724d70b3574fcd1fd6b892c58a5a7d43c65 (patch)
treea338752a53735b28c1b07715f17107bafd98f0b4
parent37bd7d70753f50a8fd2904b5b67772e012e8c107 (diff)
Load db_server and platform context objects.
-rw-r--r--src/Context/SiteContext.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/Context/SiteContext.php b/src/Context/SiteContext.php
index 2a0aec1..17fff2e 100644
--- a/src/Context/SiteContext.php
+++ b/src/Context/SiteContext.php
@@ -2,6 +2,7 @@
namespace Aegir\Provision\Context;
+use Aegir\Provision\Application;
use Aegir\Provision\Context;
use Symfony\Component\Config\Definition\ConfigurationInterface;
@@ -19,6 +20,30 @@ class SiteContext extends Context implements ConfigurationInterface
*/
public $type = 'site';
+ /**
+ * PlatformContext constructor.
+ *
+ * @param $name
+ * @param $console_config
+ * @param Application $application
+ * @param array $options
+ */
+ function __construct($name, $console_config, Application $application, array $options = [])
+ {
+ parent::__construct($name, $console_config, $application, $options);
+
+ // Load "db_server" context.
+ if (isset($this->config['db_server'])) {
+ $this->db_server = $application->getContext($this->config['service_subscriptions']['db']['server']);
+ $this->db_server->logger = $application->logger;
+
+ $this->platform = $application->getContext($this->config['platform']);
+ }
+ else {
+ throw new \Exception('No db_server found.');
+ }
+ }
+
static function option_documentation()
{
return [
@@ -35,6 +60,17 @@ class SiteContext extends Context implements ConfigurationInterface
];
}
+
+ public function verify() {
+ parent::verify();
+ $this->db_server->verify();
+ $this->platform->verify();
+
+ // @TODO: Write VHOST!
+
+ return "Site Context Verified: " . $this->name;
+ }
+
// /**
// * Write out this named context to an alias file.
// */