Commit 70702fac authored by Jon Pugh's avatar Jon Pugh

Issue #2836185 by Jon Pugh, helmo: Allow "force-reinstall" drush option for...

Issue #2836185 by Jon Pugh, helmo: Allow "force-reinstall" drush option for "provision-install" command. Fix problem when forcing install of sites that failed the first time.
parent 0bbae723
...@@ -25,6 +25,10 @@ function drush_provision_drupal_provision_install_validate() { ...@@ -25,6 +25,10 @@ function drush_provision_drupal_provision_install_validate() {
drush_log(dt('Forcing reinstall...'), 'ok'); drush_log(dt('Forcing reinstall...'), 'ok');
// Drop the database if we can figure out what it is.
// If last install failed, the database and the site folder is deleted.
if (file_exists(d()->site_path . '/drushrc.php')) {
// Load the current database name from drushrc.php. // Load the current database name from drushrc.php.
// I cannot find another way to find the current db_name! // I cannot find another way to find the current db_name!
require_once(d()->site_path . '/drushrc.php'); require_once(d()->site_path . '/drushrc.php');
...@@ -36,6 +40,7 @@ function drush_provision_drupal_provision_install_validate() { ...@@ -36,6 +40,7 @@ function drush_provision_drupal_provision_install_validate() {
'@database' => $old_db_name, '@database' => $old_db_name,
)), 'ok'); )), 'ok');
} }
}
// Destroy site_path. // Destroy site_path.
if (file_exists(d()->site_path)) { if (file_exists(d()->site_path)) {
...@@ -46,7 +51,9 @@ function drush_provision_drupal_provision_install_validate() { ...@@ -46,7 +51,9 @@ function drush_provision_drupal_provision_install_validate() {
// Check again if site does not exist after the forced reinstall. // Check again if site does not exist after the forced reinstall.
if (_provision_drupal_site_exists()) { if (_provision_drupal_site_exists()) {
return drush_set_error('PROVISION_SITE_INSTALLED'); return drush_set_error('PROVISION_SITE_INSTALLED', dt('The file !file still exists. Provision was unable to delete it.', array(
'!file' => d()->site_path . '/settings.php',
)));
} }
} }
} }
......
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