Commit a8c629d8 authored by ergonlogic's avatar ergonlogic Committed by Aegir user

Use new helper function to find legacy profile langs.

parent 2628e638
...@@ -234,18 +234,8 @@ function _provision_find_profiles() { ...@@ -234,18 +234,8 @@ function _provision_find_profiles() {
$profile->info = array_merge($profile->info, $func()); $profile->info = array_merge($profile->info, $func());
} }
$languages['en'] = 1; $profile_path = $profiles_subdir . '/' . $name;
// Find languages available $profile->info['languages'] = _provision_find_profile_languages($profile_path);
$files = array_keys(drush_scan_directory($profiles_subdir . '/' . $name . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory($profiles_subdir . '/' . $name , '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
$languages[$langcode[2]] = 1; // use the language name as an index to weed out duplicates
}
}
}
$profile->info['languages'] = array_keys($languages);
$profiles[$name] = $profile; $profiles[$name] = $profile;
drush_log(dt('Found install profile %name', array('%name' => $name))); drush_log(dt('Found install profile %name', array('%name' => $name)));
......
...@@ -245,18 +245,8 @@ function _provision_find_profiles() { ...@@ -245,18 +245,8 @@ function _provision_find_profiles() {
$profile->info = array_merge($profile->info, $func()); $profile->info = array_merge($profile->info, $func());
} }
$languages['en'] = 1; $profile_path = $profiles_subdir . '/' . $name;
// Find languages available $profile->info['languages'] = _provision_find_profile_languages($profile_path);
$files = array_keys(drush_scan_directory($profiles_subdir . '/' . $name . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory($profiles_subdir . '/' . $name , '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
$languages[$langcode[2]] = 1; // use the language name as an index to weed out duplicates
}
}
}
$profile->info['languages'] = array_keys($languages);
// Drupal 7 renamed the default install profile to 'standard' // Drupal 7 renamed the default install profile to 'standard'
// Aegir now allows projects to specify an "old short name" to provide an upgrade path when projects get renamed. // Aegir now allows projects to specify an "old short name" to provide an upgrade path when projects get renamed.
......
...@@ -149,21 +149,3 @@ function _provision_find_profiles() { ...@@ -149,21 +149,3 @@ function _provision_find_profiles() {
return $profiles; return $profiles;
} }
/**
* Find available languages for this profile.
*/
function _provision_find_profile_languages($profile_path) {
$languages = array();
$languages['en'] = 1;
// Find languages available
$files = array_keys(drush_scan_directory($profile_path . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory($profile_path, '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
$languages[$langcode[2]] = 1; // use the language name as an index to weed out duplicates
}
}
}
return array_keys($languages);
}
...@@ -748,3 +748,22 @@ function _provision_client_delete_symlink() { ...@@ -748,3 +748,22 @@ function _provision_client_delete_symlink() {
->fail('Failed to delete symlink @path: @reason'); ->fail('Failed to delete symlink @path: @reason');
} }
} }
/**
* Find available languages for a profile.
*/
function _provision_find_profile_languages($profile_path) {
$languages = array();
$languages['en'] = 1;
// Find languages available
$files = array_keys(drush_scan_directory($profile_path . '/translations', '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath'));
$files = array_merge($files, array_keys(drush_scan_directory($profile_path, '/\.po$/', array('.', '..', 'CVS'), 0, FALSE, 'filepath')));
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match('!(/|\.)([^\./]+)\.po$!', $file, $langcode)) {
$languages[$langcode[2]] = 1; // use the language name as an index to weed out duplicates
}
}
}
return array_keys($languages);
}
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