Commit 2aa1880d authored by Adrian Rossouw's avatar Adrian Rossouw Committed by adrian

L10n support for install profiles. Detects and installs sites using the...

L10n support for install profiles. Detects and installs sites using the available languages correctly. Does not currently detect the language of installed sites correctly. Will fix this along with #319299 momentarily
parent 63850dc3
......@@ -294,8 +294,11 @@ function _provision_drupal_force_load_modules($url = null) {
/**
* Install the drupal schema and install profile
*/
function _provision_drupal_install_schema($profile) {
function _provision_drupal_install_schema($profile, $language = 'en') {
include_once('includes/locale.inc');
$GLOBALS['profile'] = $profile;
$GLOBALS['install_locale'] = $language;
provision_log("install", t("Installing Drupal schema"));
// Load the profile.
require_once "./profiles/$profile/$profile.profile";
......@@ -315,14 +318,13 @@ function _provision_drupal_install_schema($profile) {
}
// Verify existence of all required modules.
$modules = drupal_verify_profile($profile, null);
$modules = drupal_verify_profile($profile, $language);
if (!$modules) {
provision_set_error(PROVISION_FRAMEWORK_ERROR);
return false;
}
// Perform actual installation defined in the profile.
drupal_install_profile($profile, $modules);
......@@ -366,6 +368,13 @@ function _provision_find_profiles() {
if (function_exists($func)) {
$profile->info = $func();
}
// Find languages available
$languages = array_keys(file_scan_directory('./profiles/' . $key, '\.po$', array('.', '..', 'CVS'), 0, FALSE, 'name'));
array_unshift($languages, 'en');
$profile->info['languages'] = $languages;
$return[$key] = $profile;
}
return $return;
......
$db_url = '<?php print "$site_db_type://$site_db_user:$site_db_passwd@$site_db_host/$site_db_name"; ?>';
$profile = "<?php print $site_profile ?>";
<?php if ($site_locale != 'en') : ?>
$locale = '<?php print $site_locale; ?>';
<?php endif; ?>
/**
* PHP settings:
*
......
......@@ -290,6 +290,10 @@ function provision_get_site_data($url) {
$site_data['site_profile'] = ($site_data['site_profile']) ? $site_data['site_profile'] : variable_get('provision_default_profile', 'default');
$site_data['site_ip'] = variable_get('provision_apache_server_ip', '127.0.0.1');
$site_data['site_port'] = variable_get('provision_apache_server_ip', 80);
//Default to english language
$site_data['site_language'] = $site_data['site_language'] ? $site_data['site_language'] : 'en';
if ($old_data = provision_load_site_data($url)) {
# Merge previously saved data with the new data. This way, old parameters overwrite new ones.
$site_data = array_merge($old_data, $site_data);
......
......@@ -389,7 +389,7 @@ function _provision_install($url, &$data) {
if (!$rolled_back) {
_provision_drupal_switch_active_site($url); # Change headers and db info, also backs up
_provision_drupal_force_load_modules($url);
_provision_drupal_install_schema($data['site_profile']);
_provision_drupal_install_schema($data['site_profile'], $data['site_language']);
_provision_drupal_force_load_modules();
_provision_drupal_switch_active_site(); # This *should* bring the site back to where we were before installing
......
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