Commit 516a06e2 authored by Adrian Rossouw's avatar Adrian Rossouw

Create a new hidden provision-install-backend command, that we call during...

Create a new hidden provision-install-backend command, that we call during provision-install, so we can isolate php errors and recover from them. should also help with OOM errors.
parent 144ef633
......@@ -31,6 +31,14 @@ function drush_provision_drupal_pre_provision_install() {
_provision_drupal_create_directories();
}
/**
* If the install went south, and the site is not PROVISION_SITE_INSTALLED, clean up behind ourselves
*/
function drush_provision_drupal_pre_provision_install_rollback() {
_provision_recursive_delete( d()->site_path );
}
/**
* Install Drupal with the pre-configured settings, by calling an external script
*
......@@ -42,25 +50,12 @@ function drush_provision_drupal_provision_install() {
provision_prepare_environment();
_provision_drupal_create_settings_file();
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE);
drush_include_engine('drupal', 'install');
provision_save_site_data();
provision_backend_invoke(d()->name, "provision-install-backend");
drush_set_option('installed', TRUE, 'site');
_provision_drupal_maintain_aliases();
}
/**
* If the install went south, and the site is not PROVISION_SITE_INSTALLED, clean up behind ourselves
*/
function drush_provision_drupal_provision_install_rollback() {
if (d()->uri) {
if (!drush_get_option('installed', FALSE)) {
_provision_recursive_delete( d()->site_path );
}
} else {
drush_set_error('PROVISION_FRAMEWORK_ERROR', dt('no url defined in %function', array('%function' => __FUNCTION__)));
}
}
/**
* Finish the installation, regenerate the caches on the site so that
* any changes to things such as available modules/ themes can take affect.
......
......@@ -86,6 +86,14 @@ function _provision_drupal_site_exists() {
return file_exists(d()->site_path . '/settings.php');
}
/**
* This command does the actual installation in it's own thread,
* so we can recover gracefully if things go really wrong.
*/
function drush_provision_drupal_provision_install_backend() {
drush_include_engine('drupal', 'install');
}
/**
* Sync the current Drupal platform and, if applicable, site. Call after
* finishing operations that affect the filesystem.
......
......@@ -82,11 +82,16 @@ function provision_drush_command() {
'bootstrap' => DRUSH_BOOTSTRAP_DRUSH,
);
$items['provision-install'] = array(
'arguments' => array('domain.com' => dt('The domain of the site to install.')),
'description' => dt('Provision a new site using the provided data.'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT
);
$items['provision-install-backend'] = array(
'description' => dt('Provision a new site using the provided data.'),
'hidden' => TRUE,
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE
);
$items['provision-import'] = array(
'arguments' => array('domain.com' => dt('The domain of the site to import.')),
'description' => dt('Turn an already running site into a provisioned site.'),
......
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