Commit d613313d authored by Adrian Rossouw's avatar Adrian Rossouw

when a platform root is no longer found, check if it has an associated...

when a platform root is no longer found, check if it has an associated makefile and fetch automatically. #373062
parent 8dccb7f6
......@@ -44,35 +44,6 @@ function provision_drupal_drush_engine_drupal() {
return $engines;
}
/**
* Initialize the platform / site
*
* This function is executed by drush_invoke, and is responsible
* for populating the $data context array
*/
function provision_drupal_drush_init() {
$command = drush_get_command();
$command = explode(" ", $command['command']);
if (preg_match("/^provision-/", $command[0])) {
_provision_context_init();
}
}
function _provision_context_init() {
static $is_run = false;
if ($is_run) {
return TRUE;
}
if ((d()->type === 'platform' || d()->type === 'site') && 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);
}
$is_run = TRUE;
}
/**
* Finalize the platform / site
......
......@@ -21,7 +21,7 @@ function drush_provision_drupal_provision_verify_validate() {
/**
* implementation of provision_verify
*/
function drush_provision_drupal_provision_verify() {
function drush_provision_drupal_pre_provision_verify() {
if (d()->type === 'server') {
provision_file()->create_dir(d()->config_path, dt('Provision configuration'), 0711);
......@@ -42,6 +42,22 @@ function drush_provision_drupal_provision_verify() {
}
}
elseif (d()->type === 'platform') {
// create a platform from a makefile, if it doesnt already exist and the makefile does.
if (!provision_file()->exists(d()->root)->status() && !empty(d()->makefile)) {
if (provision_file()->exists(d()->makefile)->status()) {
drush_log(dt("Platform path does not exists, fetching from drush makefile"));
drush_backend_invoke("make", array(d()->makefile, d()->root), array('root' => null, 'uri' => null));
if (!drush_get_error()) {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
}
else {
return drush_set_error("DRUSH_MAKE_FAILED",
"Could not download platform using drush make. No platform present");
}
}
}
provision_file()->writable(d()->root . '/sites')
->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');
......
......@@ -441,6 +441,8 @@ class provisionPlatform extends provisionEnvironment {
$this->setProperty('web_server', '@server_master');
$this->is_oid('web_server');
$this->service_subscribe('http', $this->web_server->name);
$this->setProperty('makefile', '');
}
function verify() {
......
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