Commit 1f03d0ee authored by anarcat's avatar anarcat Committed by anarcat

Merge branch 'master' of ssh://git.koumbit.net/provision

parents c59dce00 639273ed
......@@ -5,7 +5,14 @@ function drush_provision_mysql_provision_deploy_validate() {
}
function drush_provision_mysql_provision_deploy($url) {
$db_type = drush_set_option('db_type', drush_get_option('db_type'), 'site');
$db_type = drush_get_option('db_type');
// As of Drupal 7 there is no more mysqli type
if (drush_drupal_major_version() >= 7) {
$db_type = ($db_type == 'mysqli') ? 'mysql' : $db_type;
}
$db_type = drush_set_option('db_type', $db_type, 'site');
$db_host = drush_set_option('db_host', drush_get_option('db_host'), 'site');
$db_passwd = drush_set_option('db_passwd', provision_password(), 'site');
$db_name = drush_set_option('db_name', _provision_mysql_suggest_db_name($url), 'site');
......
......@@ -5,7 +5,14 @@ function drush_provision_mysql_provision_install_validate() {
}
function drush_provision_mysql_pre_provision_install($url = NULL) {
$db_type = drush_set_option('db_type', drush_get_option('db_type'), 'site');
$db_type = drush_get_option('db_type');
// As of Drupal 7 there is no more mysqli type
if (drush_drupal_major_version() >= 7) {
$db_type = ($db_type == 'mysqli') ? 'mysql' : $db_type;
}
$db_type = drush_set_option('db_type', $db_type, 'site');
$db_host = drush_set_option('db_host', drush_get_option('db_host'), 'site');
$db_passwd = drush_set_option('db_passwd', provision_password(), 'site');
$db_name = drush_set_option('db_name', _provision_mysql_suggest_db_name($url), 'site');
......
......@@ -56,25 +56,34 @@ function install_main() {
require_once('install.php');
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION);
// We have an existing settings.php.
$db_spec = _drush_sql_get_db_spec();
$db_spec['db_prefix'] = $GLOBALS['db_prefix'];
if ($db_spec['driver'] == 'mysqli') {
$db_spec['driver'] = 'mysql';
}
unset($conf['site_name']);
unset($conf['site_mail']);
unset($GLOBALS['db_url']);
$account_pass = provision_password();
$settings = array(
'parameters' => array(
'profile' => $profile,
'locale' => $install_locale,
),
'settings_verified' => TRUE,
'forms' => array(
/* 'install_settings_form' => array(
'driver' => drush_get_option('db_type'),
'host' => drush_get_option('db_host'),
'port' => drush_get_option('db_port'),
'database' => drush_get_option('db_name'),
'username' => drush_get_option('db_user'),
'password' => drush_get_option('db_passwd'),
),*/
'install_settings_form' => $db_spec,
'install_configure_form' => array(
'site_name' => $url,
'site_mail' => $client_email ? $client_email : 'admin@example.com',
'theme' => 'garland',
'account' => array(
'name' => 'admin',
'mail' => $client_email ? $client_email : 'admin@example.com',
......@@ -91,13 +100,11 @@ function install_main() {
),
),
);
set_exception_handler('install_exception_handler');
set_error_handler('install_exception_handler');
try {
install_drupal($settings);
}
catch (Exception $e) {
drush_log($e->message());
drush_set_error('DRUPAL_INSTALL_FAILED');
dlm($e);
}
_provision_drupal_create_directories($url);
......
......@@ -21,5 +21,12 @@ function drush_provision_drupal_provision_login_reset($url) {
// pass the login link to the front end
drush_set_option('login_link', $onetime);
drush_log(t('Login url: !onetime', array('!onetime' => $onetime)), 'message');
sess_destroy_uid(1);
if (drush_drupal_major_version() >= 7) {
drupal_session_destroy_uid(1);
}
else {
// valid for d5 and d6
sess_destroy_uid(1);
}
}
......@@ -595,4 +595,9 @@ function provision_prepare_environment() {
foreach ($fields as $key) {
$_SERVER[$key] = drush_get_option($key, null, 'site');
}
// As of Drupal 7 there is no more mysqli type
if (drush_drupal_major_version() >= 7) {
$_SERVER['db_type'] = ($_SERVER['db_type'] == 'mysqli') ? 'mysql' : $_SERVER['db_type'];
}
}
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