From e9d97f1eef493de9b9cb3ae456175ce33b5cb796 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 8 Jun 2009 09:23:55 +0000 Subject: - Patch #449198 by boombatower: cealn up test loading and related API. --- includes/registry.inc | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'includes/registry.inc') diff --git a/includes/registry.inc b/includes/registry.inc index cfc7ae118..89de42356 100644 --- a/includes/registry.inc +++ b/includes/registry.inc @@ -45,11 +45,19 @@ function _registry_rebuild() { system_get_files_database($modules, 'module'); // Get the list of files we are going to parse. $files = array(); - foreach ($modules as $module) { + foreach ($modules as &$module) { + $dir = dirname($module->filepath); + + // Store the module directory for use in hook_registry_files_alter(). + $module->dir = $dir; + + // Parse the .info file for all modules, reguardless of their status so the + // list of files can then be used in hook_registry_files_alter() + // implementations. + $module->info = drupal_parse_info_file($dir . '/' . $module->name . '.info'); + if ($module->status) { - // Parse .info file only for enabled modules. - $module->info = drupal_parse_info_file(dirname($module->filepath) . '/' . $module->name . '.info'); - $dir = dirname($module->filepath); + // Add files for enabled modules to the registry. foreach ($module->info['files'] as $file) { $files["$dir/$file"] = array('module' => $module->name, 'weight' => $module->weight); } @@ -59,6 +67,13 @@ function _registry_rebuild() { $files["$filename"] = array('module' => '', 'weight' => 0); } + // Allow modules to manually modify the list of files before the registry + // parses them. The $modules array provides the .info file information, which + // includes the list of files registered to each module. Any files in the + // list can then be added to the list of files that the registry will parse, + // or modify attributes of a file. + drupal_alter('registry_files', $files, $modules); + foreach (registry_get_parsed_files() as $filename => $file) { // Add the md5 to those files we've already parsed. if (isset($files[$filename])) { -- cgit v1.2.3