diff --git a/includes/install.inc b/includes/install.inc index 70ab3c709441627ad86f971c2765f6ddeacd9689..e3233946e56d8f7938da323f8471b5b27b8fa429 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -977,23 +977,49 @@ function drupal_check_module($module) { /** * Retrieve info about an install profile from its .info file. + * + * Information stored in the profile.info file: + * - name: The real name of the install profile for display purposes. + * - description: A brief description of the profile. + * - dependencies: An array of shortnames of other modules this install profile requires. + * - tasks: An associative array of tasks and the page title of each task that need to be + * completed for installation. + * + * Example of .info file: + * @verbatim + * name = Drupal (minimal) + * description = Create a Drupal site with only required modules enabled. + * dependencies[] = block + * dependencies[] = dblog + * @endverbatim + * + * @param profile + * Name of profile. + * @param locale + * Name of locale used (if any). + * @return + * The info array. */ function install_profile_info($profile, $locale = 'en') { - $cache =& drupal_static('install_profile_info', array(), TRUE); - // Set defaults for module info. - $defaults = array( - 'dependencies' => array(), - 'tasks' => array(), - 'description' => '', - 'version' => NULL, - 'php' => DRUPAL_MINIMUM_PHP, - ); - $info = drupal_parse_info_file(sprintf('profiles/%s/%s.info', $profile, $profile)) + $defaults; - $info['dependencies'] = array_unique(array_merge( - drupal_required_modules(), - $info['dependencies'], - ($locale != 'en' && !empty($locale) ? array('locale') : array())) - ); - return $info; + $cache = &drupal_static(__FUNCTION__, array()); + + if (!isset($cache[$profile])) { + // Set defaults for module info. + $defaults = array( + 'dependencies' => array(), + 'tasks' => array(), + 'description' => '', + 'version' => NULL, + 'php' => DRUPAL_MINIMUM_PHP, + ); + $info = drupal_parse_info_file("profiles/$profile/$profile.info") + $defaults; + $info['dependencies'] = array_unique(array_merge( + drupal_required_modules(), + $info['dependencies'], + ($locale != 'en' && !empty($locale) ? array('locale') : array())) + ); + $cache[$profile] = $info; + } + return $cache[$profile]; } diff --git a/install.php b/install.php index b76bb601739fbf7f4355e8aed946dc0d4e8cf129..30c2de0294fca7ec7a7bfce6f317d53d9d6c4151 100644 --- a/install.php +++ b/install.php @@ -972,8 +972,10 @@ function install_task_list($active = NULL) { // Add tasks defined by the profile. if ($profile) { $info = install_profile_info($profile); - if (array_key_exists('tasks', $info)) { - $tasks += $info['tasks']; + if (isset($info['tasks'])) { + foreach ($info['tasks'] as $task => $title) { + $tasks[$task] = st($title); + } } } diff --git a/modules/simpletest/tests/module.test b/modules/simpletest/tests/module.test index b5967157fa8e395fba9673d325a5a818dba8c9c7..ee95044e0a274b8a70f4e306b350e5db3b0f3d4a 100644 --- a/modules/simpletest/tests/module.test +++ b/modules/simpletest/tests/module.test @@ -23,7 +23,8 @@ class ModuleUnitTest extends DrupalWebTestCase { */ function testModuleList() { // Build a list of modules, sorted alphabetically. - $module_list = drupal_get_profile_modules('default', 'en'); + $profile_info = install_profile_info('default', 'en'); + $module_list = $profile_info['dependencies']; sort($module_list); // Compare this list to the one returned by module_list(). We expect them // to match, since all default profile modules have a weight equal to 0