summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/install.inc58
-rw-r--r--install.php6
-rw-r--r--modules/simpletest/tests/module.test3
3 files changed, 48 insertions, 19 deletions
diff --git a/includes/install.inc b/includes/install.inc
index 70ab3c709..e3233946e 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 b76bb6017..30c2de029 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 b5967157f..ee95044e0 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