Commit 7dd18a41 authored by Adrian Rossouw's avatar Adrian Rossouw

shifted around where things happen during verify, so that platform verify is very light weight.

parent b00d8232
......@@ -11,7 +11,7 @@
include_once(dirname(__FILE__) . '/../provision.service.inc');
function db_drush_init($url) {
function db_drush_init($url = null) {
include_once('mysql/mysql_service.inc');
......@@ -326,8 +326,7 @@ class provisionService_db_pdo extends provisionService_db {
function __construct($creds) {
parent::__construct($creds);
print_r($creds);
$this->dsn = sprintf("%s:dbname=%s;host=%s", $this->PDO_type, $this->creds['name'], $this->creds['host']);
$this->dsn = sprintf("%s:host=%s", $this->PDO_type, $this->creds['host']);
}
......
......@@ -10,7 +10,7 @@ function drush_db_provision_verify_validate() {
* Can't be rolled back.
*/
function drush_db_provision_verify() {
if (PROVISION_CONTEXT_PLATFORM) {
if (PROVISION_CONTEXT_SERVER) {
provision_service('db')->verify();
}
}
......
......@@ -40,15 +40,15 @@ class provisionService_http_apache extends provisionService_http {
function verify($url) {
if (PROVISION_CONTEXT_PLATFORM) {
provision_service('file')->create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
provision_service('file')->create_dir(drush_get_option('platform_conf_path'), dt("Platforms configuration"), 0700);
provision_service('file')->create_dir(drush_get_option('config_path') . '/apache.d' , dt("Apache configuration"), 0700);
if (drush_get_option('platform', null)) {
$this->create_platform_config();
}
}
elseif (PROVISION_CONTEXT_SERVER) {
provision_service('file')->create_dir(drush_get_option('vhost_path'), dt("Virtual host configuration"), 0700);
provision_service('file')->create_dir(drush_get_option('platform_conf_path'), dt("Platforms configuration"), 0700);
provision_service('file')->create_dir(drush_get_option('config_path') . '/apache.d' , dt("Apache configuration"), 0700);
$this->create_server_config();
}
elseif (PROVISION_CONTEXT_SITE) {
......
......@@ -2,11 +2,12 @@
include_once(dirname(__FILE__) . '/../provision.service.inc');
function http_drush_init() {
function http_drush_init($url = null) {
$command = drush_get_command();
$command = explode(" ", $command['command']);
if (preg_match("/^provision-/", $command[0])) {
_provision_context_init($url);
include_once('apache/apache_service.inc');
provision_service('http', new provisionService_http_apache());
......
......@@ -58,26 +58,32 @@ function provision_drupal_drush_init($url = NULL) {
}
function _provision_context_init($url) {
$context = 'server';
if (drush_bootstrap_validate(DRUSH_BOOTSTRAP_DRUPAL_ROOT)) {
// i don't think i should be bootstrapping here yet ... but i have no choice yet.
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
$context = 'platform';
if ($url) {
$context = 'site';
drush_set_option('uri' , 'http://' . $url);
drush_set_default('site_url', $url);
drush_set_default('profile', 'default');
drush_set_default('language', 'en');
drush_set_default('aliases', array());
}
static $is_run = false;
if ($is_run) {
return TRUE;
}
$context = 'server';
if (drush_bootstrap_validate(DRUSH_BOOTSTRAP_DRUPAL_ROOT)) {
// i don't think i should be bootstrapping here yet ... but i have no choice yet.
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
$context = 'platform';
if ($url) {
$context = 'site';
drush_set_option('uri' , 'http://' . $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_SERVER', $context == 'server');
define('PROVISION_CONTEXT_PLATFORM', $context == 'platform');
define('PROVISION_CONTEXT_SITE', $context == 'site');
}
define('PROVISION_CONTEXT_SERVER', $context == 'server');
define('PROVISION_CONTEXT_PLATFORM', $context == 'platform');
define('PROVISION_CONTEXT_SITE', $context == 'site');
$is_run = TRUE;
}
......
......@@ -24,7 +24,7 @@ function drush_provision_drupal_provision_verify_validate($url = null) {
* implementation of provision_verify
*/
function drush_provision_drupal_provision_verify($url = null) {
if (PROVISION_CONTEXT_PLATFORM) {
if (PROVISION_CONTEXT_SERVER) {
provision_service('file')->create_dir(drush_get_option('config_path'), dt('Provision configuration'), 0711);
provision_service('file')->create_dir(drush_get_option('config_path') . '/includes', dt('Provision PHP configuration'), 0711);
if (!provision_service('file')->exists(drush_get_option('config_path') . '/includes/global.inc')->succeed('Global configuration file exists')->status()) {
......@@ -34,6 +34,8 @@ function drush_provision_drupal_provision_verify($url = null) {
$config->write();
}
provision_service('file')->create_dir(drush_get_option('backup_path'), dt('Backup'), 0700);
}
elseif (PROVISION_CONTEXT_PLATFORM) {
provision_service('file')->writable(drush_get_option('sites_path'))
->succeed('Drupal sites directory @path is writable by the provisioning script')
->fail('Drupal sites directory @path is not writable by the provisioning script', 'PROVISION_SITES_DIR_NOT_WRITABLE');
......
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