Commit e0efc704 authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

fix for #319299. Now detects language and install profile correctly. Also...

fix for #319299. Now detects language and install profile correctly. Also fixed a missing variable_set when installing new sites using aegir.
parent 2aa1880d
......@@ -75,6 +75,14 @@ function _provision_mysql_create_database($name) {
db_query("CREATE DATABASE %s", $name);
}
/**
* Close an active connection. There's no clean way to close a connection
* in the Drupal db api. Sadly.
*/
function db_close($connection) {
return mysql_close($connection);
}
function _provision_mysql_can_create_database() {
$test = 'provision_test';
_provision_mysql_create_database($test);
......
......@@ -333,7 +333,9 @@ function _provision_drupal_install_schema($profile, $language = 'en') {
if (function_exists($function)) {
// More steps required
$profile_message = $function();
}
}
variable_set('install_profile', $profile);
}
/**
......@@ -449,9 +451,15 @@ function _provision_drupal_import_site($url) {
*
* This information is no longer stored in settings.php
*/
_provision_drupal_switch_active_site($url);
$data['site_profile'] = variable_get('install_profile', 'default');
_provision_drupal_switch_active_site();
provision_set_active_db($db_url);
$install_profile = db_result(db_query("SELECT value FROM {variable} WHERE name='install_profile'"));
$data['site_profile'] = ($install_profile) ? unserialize($install_profile) : 'default';
$has_locale = db_result(db_query("SELECT status FROM system WHERE type='module' AND name='locale'"));
if ($has_locale) {
$locale = db_result(db_query("SELECT locale FROM locales_meta WHERE isdefault=1 AND enabled=1"));
}
$data['site_language'] = ($locale) ? ($locale) : 'en';
provision_close_active_db();
$data['site_installed'] = TRUE;
}
provision_save_site_data($url, $data);
......
......@@ -495,6 +495,24 @@ function provision_set_active_db($new_db_url = null) {
db_set_active('default');
}
}
/**
* Close an active connection
*
* This is an INCREDIBLY dangerous function, that is only used during import of sites
* to avoid creating connections for every site being imported
*/
function provision_close_active_db() {
global $active_db;
$close_db = $active_db;
db_set_active('default');
if ($close_db !== $active_db) {
db_close($close_db);
}
}
/**
* Check whether a user is a member of a group.
*
......
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