Commit e3c9da7a authored by drumm's avatar drumm Committed by Neil Drumm

Use environment API for context saving

parent a119dbcb
......@@ -263,13 +263,6 @@ class provisionService_db extends provisionService {
function grant_host() {
return 'localhost';
}
/**
* Write out server's drushrc alias file.
*/
function context_options() {
return array('master_db');
}
}
/**
......
<?php
class provisionService_http_cluster extends provisionService_http {
function context_options() {
return array('provision-http-cluster-web-servers');
}
}
......@@ -70,11 +70,4 @@ class provisionService_http extends provisionService {
function delete_server_config() {
return TRUE;
}
/**
* Write out server's drushrc alias file.
*/
function context_options() {
return array('web_ports', 'web_group', 'restart_cmd');
}
}
......@@ -150,14 +150,9 @@ class provisionConfig_drushrc_alias extends provisionConfig_drushrc {
* Array of string option names to save.
*/
function __construct($name, $options = array()) {
$options_expanded = array();
foreach ($options as $key) {
$options_expanded[$key] = drush_get_option($key);
}
$this->data = array(
'aliasname' => ltrim($name, '@'),
'options' => $options_expanded,
'options' => $options,
);
}
......
......@@ -77,7 +77,7 @@ class provisionEnvironment {
*/
function __get($name) {
if ($name == 'options') {
return drush_sitealias_get_record($this->name);
return array_merge(drush_sitealias_get_record($this->name), drush_get_context('stdin'));
}
if (array_key_exists($name, $this->properties)) {
if (isset($this->oid_map[$name]) && !empty($this->properties[$name])) {
......@@ -169,7 +169,12 @@ class provisionEnvironment {
* Write out this named context to an alias file.
*/
function write_alias() {
$config = new provisionConfig_drushrc_alias($this->name, $this->context_options());
foreach ($this->map as $key => $type) {
if ($type === $this->type) {
$options[$key] = $this->properties[$key];
}
}
$config = new provisionConfig_drushrc_alias($this->name, $options);
$config->write();
}
}
......@@ -259,20 +264,6 @@ class provisionServer extends provisionEnvironment {
}
return $return;
}
/**
* Options this environment will save in its context file.
*/
function context_options() {
$options = array_merge(
array('provision-host', 'provision-user', 'config_path', 'backup_path'),
d()->services_invoke('context_options')
);
foreach (array_keys($this->services) as $service) {
$options[] = $service . '-service-type';
}
return $options;
}
}
/**
......@@ -293,14 +284,6 @@ class provisionPlatform extends provisionServer {
$this->setProperty('sites_path', $this->root . '/sites');
}
/**
* Options this environment will save in its context file.
*/
function context_options() {
drush_set_option('platform-name', preg_replace('/^platform_/', '', drush_get_option('hosting_name')));
return array('provision-http-server', 'root', 'platform-name');
}
}
class provisionSite extends provisionPlatform {
......@@ -332,13 +315,4 @@ class provisionSite extends provisionPlatform {
// this can potentially be handled by a drupal sub class
$this->setProperty('profile', 'default');
}
/**
* Options this environment will save in its context file.
*/
function context_options() {
return array('provision-db-server', 'provision-platform', 'uri', 'site_port', 'site_id', 'language', 'client_email');
}
}
......@@ -104,10 +104,6 @@ class provisionService {
return $this;
}
function context_options() {
return array();
}
}
class provisionService_null extends provisionService {
......
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