You are here

function coder_upgrade_cache_theme_registry in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_upgrade/conversions/begin.inc \coder_upgrade_cache_theme_registry()

Caches the theme registry from core files (including disabled modules).

2 calls to coder_upgrade_cache_theme_registry()
coder_upgrade_create_theme_cache_submit in coder_upgrade/includes/settings.inc
Submit callback; creates a core theme information cache file.
coder_upgrade_upgrade_begin_alter in coder_upgrade/conversions/begin.inc
Implements hook_upgrade_begin_alter().

File

coder_upgrade/conversions/begin.inc, line 35
Provides conversion routines applied to the directory before routines are applied to the files.

Code

function coder_upgrade_cache_theme_registry() {
  global $_coder_upgrade_theme_registry;

  // If this condition is not met, then the code is being run in a separate
  // process and the core theme information is read from a file.
  if (!$_coder_upgrade_theme_registry) {
    if ($cache = cache_get('upgrade_theme_registry', 'cache')) {

      // @todo Compare mtime of newest core code file to the created timestamp field in the cache.
      if (TRUE || $cache->created > $mtime_newest_core_file) {
        $_coder_upgrade_theme_registry = $cache->data;
      }
    }
    else {

      // Cache the theme registry (includes only enabled modules).
      $_coder_upgrade_theme_registry = theme_get_registry();
      if (!$_coder_upgrade_theme_registry) {
        drupal_theme_initialize();
        $_coder_upgrade_theme_registry = theme_get_registry();
      }

      // Build and cache the theme registry for disabled modules.
      $_coder_upgrade_theme_registry += coder_upgrade_theme_build_registry();

      // Store in persistent cache.
      cache_set('upgrade_theme_registry', $_coder_upgrade_theme_registry, 'cache');
    }
  }
}