diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-06-06 16:05:28 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-06-06 16:05:28 +0000 |
commit | 1f9077ee9263a64eb62cfdb75d7a5233cb86e83c (patch) | |
tree | 951ff40932870affff95e58ae3a2af27b86f1879 /includes | |
parent | 36e3d552cfe211cba22d1fc8cf0a7f4b13627179 (diff) | |
download | brdo-1f9077ee9263a64eb62cfdb75d7a5233cb86e83c.tar.gz brdo-1f9077ee9263a64eb62cfdb75d7a5233cb86e83c.tar.bz2 |
- Patch #147000 by Berdir: unify and rewrite module_rebuild_cache() and system_theme_data().
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 4 | ||||
-rw-r--r-- | includes/install.inc | 4 | ||||
-rw-r--r-- | includes/module.inc | 69 | ||||
-rw-r--r-- | includes/theme.inc | 2 | ||||
-rw-r--r-- | includes/theme.maintenance.inc | 2 |
5 files changed, 6 insertions, 75 deletions
diff --git a/includes/common.inc b/includes/common.inc index 35a1ccf46..5f5f9b66e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4555,10 +4555,10 @@ function drupal_flush_all_caches() { // If invoked from update.php, we must not update the theme information in the // database, or this will result in all themes being disabled. if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'update') { - _system_theme_data(); + _system_get_theme_data(); } else { - system_theme_data(); + system_get_theme_data(); } drupal_theme_rebuild(); diff --git a/includes/install.inc b/includes/install.inc index 5f296477b..03ee3e4bd 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -495,7 +495,7 @@ function drupal_verify_profile($profile, $locale) { * Normally just testing wants to set this to TRUE. */ function drupal_install_modules($module_list = array(), $disable_modules_installed_hook = FALSE) { - $files = module_rebuild_cache(); + $files = system_get_module_data(); $module_list = array_flip(array_values($module_list)); do { $moved = FALSE; @@ -592,7 +592,7 @@ function drupal_install_system() { ->execute(); // Now that we've installed things properly, bootstrap the full Drupal environment drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); - module_rebuild_cache(); + system_get_module_data(); } /** diff --git a/includes/module.inc b/includes/module.inc index aea3c8f96..e0b3ceaad 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -76,75 +76,6 @@ function module_list($refresh = FALSE, $sort = FALSE, $fixed_list = NULL) { } /** - * Rebuild the database cache of module files. - * - * @return - * The array of filesystem objects used to rebuild the cache. - */ -function module_rebuild_cache() { - // Get current list of modules, including uninstalled modules. - $files = drupal_system_listing('/\.module$/', 'modules', 'name', 0); - - // Extract current files from database. - system_get_files_database($files, 'module'); - - ksort($files); - - // Set defaults for module info - $defaults = array( - 'dependencies' => array(), - 'dependents' => array(), - 'description' => '', - 'package' => 'Other', - 'version' => NULL, - 'php' => DRUPAL_MINIMUM_PHP, - 'files' => array(), - ); - - foreach ($files as $filepath => $file) { - // Look for the info file. - $file->info = drupal_parse_info_file(dirname($file->filepath) . '/' . $file->name . '.info'); - - // Skip modules that don't provide info. - if (empty($file->info)) { - unset($files[$filepath]); - continue; - } - // Merge in defaults and save. - $files[$filepath]->info = $file->info + $defaults; - - // Invoke hook_system_info_alter() to give installed modules a chance to - // modify the data in the .info files if necessary. - drupal_alter('system_info', $files[$filepath]->info, $files[$filepath]); - - // Update the contents of the system table: - if (isset($file->status) || (isset($file->old_filepath) && $file->old_filepath != $file->filepath)) { - db_update('system') - ->fields(array( - 'info' => serialize($files[$filepath]->info), - 'name' => $file->name, - 'filename' => $file->filepath)) - ->condition('filename', $file->old_filepath) - ->execute(); - } - else { - // This is a new module. - $files[$filepath]->status = 0; - db_insert('system') - ->fields(array( - 'name' => $file->name, - 'info' => serialize($files[$filepath]->info), - 'type' => 'module', - 'filename' => $file->filepath, - 'status' => 0)) - ->execute(); - } - } - $files = _module_build_dependencies($files); - return $files; -} - -/** * Find dependencies any level deep and fill in required by information too. * * @param $files diff --git a/includes/theme.inc b/includes/theme.inc index f82e9b00d..a723e6fe3 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -528,7 +528,7 @@ function list_themes($refresh = FALSE) { } else { // Scan the installation when the database should not be read. - $themes = _system_theme_data(); + $themes = _system_get_theme_data(); } foreach ($themes as $theme) { diff --git a/includes/theme.maintenance.inc b/includes/theme.maintenance.inc index 915a5794b..3267e1d01 100644 --- a/includes/theme.maintenance.inc +++ b/includes/theme.maintenance.inc @@ -223,7 +223,7 @@ function template_preprocess_maintenance_page(&$variables) { global $theme; // Retrieve the theme data to list all available regions. - $theme_data = _system_theme_data(); + $theme_data = _system_get_theme_data(); $regions = $theme_data[$theme]->info['regions']; // Get all region content set with drupal_add_region_content(). |