Commit ba6f1299 authored by Adrian Rossouw's avatar Adrian Rossouw

just saving where i was. working on moving the init code to the right places.

parent a29bb73e
......@@ -4,6 +4,14 @@
class provisionService_http_apache extends provisionService_http {
function init(&$owner) {
parent::init($owner);
$owner->setProperty('apache_site_conf_path', $owner->config_path . '/vhost.d');
$owner->setProperty('apache_platform_conf_path', $owner->config_path . '/platform.d');
// Commands
$owner->setProperty('restart_cmd', _provision_default_restart_cmd());
}
function create_site_config($url) {
$config = new provisionConfig_apache_site(drush_get_merged_options());
......
......@@ -9,42 +9,17 @@ function http_provision_services() {
class provisionService_http extends provisionService {
function init($options) {
// Set up defines for platform
$docroot = drush_get_option(array("r", "root"), $_SERVER['PWD']);
$path = drush_set_default('docroot_path', rtrim(($docroot) ? $docroot : $_SERVER['DOCUMENT_ROOT'], '/'));
drush_set_default('sites_path', $path . '/sites');
drush_set_default('publish_path', realpath(drush_get_option('docroot_path')));
$parts = explode("/", $path);
array_pop($parts);
$parent_path = drush_set_default('parent_path', implode("/" , $parts));
drush_set_default('backup_path', $parent_path . '/backups');
drush_set_default('config_path', $parent_path . '/config');
$config_path = drush_get_option('config_path');
drush_set_default('vhost_path', $config_path . '/vhost.d');
drush_set_default('platform_conf_path', $config_path . '/platform.d');
// Commands
drush_set_default('restart_cmd', _provision_default_restart_cmd());
function init(&$owner) {
parent::init($owner);
// System account
drush_set_default('web_group', _provision_default_web_group());
drush_set_default('script_user', get_current_user());
$owner->setProperty('web_group', _provision_default_web_group());
// Redirection urls
drush_set_default('master_url', $GLOBALS['base_url']);
$master_url = drush_get_option('master_url');
drush_set_default('web_disable_url', $master_url .'/hosting/disabled');
drush_set_default('web_maintenence_url', $master_url .'/hosting/maintenance');
drush_set_default('web_ip', '127.0.0.1');
drush_set_default('web_port', 80);
$owner->setProperty('web_disable_url', $this->master_url .'/hosting/disabled');
$owner->setProperty('web_maintenence_url', $this->master_url .'/hosting/maintenance');
drush_set_default('site_port', 80);
$owner->setProperty('web_ip', '127.0.0.1');
$owner->setProperty('web_port', 80);
}
/**
......
......@@ -52,17 +52,7 @@ function provision_drupal_drush_init($url = NULL) {
$command = explode(" ", $command['command']);
if (preg_match("/^provision-/", $command[0])) {
if ($url) {
// this stuff gets moved to environment
drush_set_option('uri' , 'http://' . $url);
provision_load_site_data($url);
drush_set_default('site_url', $url);
drush_set_default('profile', 'default');
drush_set_default('language', 'en');
drush_set_default('aliases', array());
}
define('PROVISION_CONTEXT_SITE', ($url) ? TRUE : FALSE);
define('PROVISION_CONTEXT_SITE', (d()->type == 'site') ? TRUE : FALSE);
define('PROVISION_CONTEXT_PLATFORM', !PROVISION_CONTEXT_SITE);
}
}
......
......@@ -98,6 +98,10 @@ class provisionEnvironment {
function setMap($field, $context) {
$this->map[$field] = $context;
}
function getProperties() {
return $this->properties;
}
}
class provisionServer extends provisionEnvironment {
......@@ -115,6 +119,8 @@ class provisionServer extends provisionEnvironment {
$this->setProperty('config_path', $this->aegir_root . '/config');
$this->setProperty('alias_path', $this->config_path . '/drush.d');
$this->setProperty('master_url');
}
function init() {
......@@ -129,7 +135,6 @@ class provisionServer extends provisionEnvironment {
}
}
function spawn_service($service, $default = null) {
$reflect = new reflectionClass('provisionService_' . $service);
$base_dir = dirname($reflect->getFilename());
......@@ -145,6 +150,7 @@ class provisionServer extends provisionEnvironment {
include_once($file);
$object = new $className();
$object->init($this->options);
$this->services[$service] = $object;
$this->$service = $object;
}
}
......@@ -165,6 +171,11 @@ class provisionPlatform extends provisionServer {
parent::__construct($options);
$this->type = 'platform';
$this->setProperty('root', $_SERVER['PWD']);
// publish path can really be removed ...
$this->setProperty('publish_path', $this->root);
$this->setProperty('sites_path', $this->root . '/sites');
}
}
......@@ -181,9 +192,11 @@ class provisionSite extends provisionPlatform {
$this->type = 'site';
$this->setProperty('uri');
$this->setProperty('site_url', str_replace(array('https://', 'http://'), '', $this->uri));
$this->setProperty('profile', 'default');
$this->setProperty('language', 'en');
$this->setProperty('aliases', array());
$this->setProperty('site_port', 80);
$this->setProperty('client_email');
// todo - turn into a re-usable mechanism for comma separated values
if ($this->options['aliases'] && !is_array($site_data['aliases'])) {
......@@ -193,6 +206,10 @@ class provisionSite extends provisionPlatform {
$this->aliases = array();
}
// this can potentially be handled by a drupal sub class
$this->setProperty('profile', 'default');
}
}
......
<?php
class provisionService {
protected $owner_name = '@self';
function verify() {
return TRUE;
}
......@@ -9,8 +10,6 @@ class provisionService {
function init() {
return TRUE;
}
}
class provisionConfig {
......
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