Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.243 diff -u -p -r1.243 bootstrap.inc --- includes/bootstrap.inc 31 Oct 2008 02:18:22 -0000 1.243 +++ includes/bootstrap.inc 31 Oct 2008 09:48:20 -0000 @@ -191,6 +191,12 @@ define('LANGUAGE_NEGOTIATION_DOMAIN', 3) define('REQUEST_TIME', $_SERVER['REQUEST_TIME']); /** + * Indicates that the _registry_check_code function should write + * the registry lookup misses from this request to cache. + */ +define('REGISTRY_CHECK_CODE_WRITE_CACHE', FALSE); + +/** * @name Title text filtering flags * @{ * Flags for use in drupal_set_title(). @@ -1446,7 +1452,24 @@ function drupal_autoload_class($class) { /** * Helper to check for a resource in the registry. */ -function _registry_check_code($type, $name) { +function _registry_check_code($type, $name = NULL) { + static $misses = array(), $cache_count = 0; + + if ($type == REGISTRY_CHECK_CODE_WRITE_CACHE && count($misses) > $cache_count) { + cache_set('registry_check_code_misses', $misses, 'cache_registry'); + return; + } + + if ($misses === NULL) { + $cache = cache_get('registry_check_code_misses', 'cache_registry'); + $misses = $cache ? $cache->data : array(); + $cache_count = count($misses); + } + + if (isset($misses[$type . '_' . $name])) { + return FALSE; + } + $file = db_query("SELECT filename FROM {registry} WHERE name = :name AND type = :type", array( ':name' => $name, ':type' => $type, @@ -1457,7 +1480,10 @@ function _registry_check_code($type, $na registry_mark_code($type, $name); return TRUE; } - return FALSE; + else { + $misses[$type . '_' . $name] = TRUE; + return FALSE; + } } /** Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.814 diff -u -p -r1.814 common.inc --- includes/common.inc 31 Oct 2008 02:23:24 -0000 1.814 +++ includes/common.inc 31 Oct 2008 09:48:21 -0000 @@ -1610,6 +1610,7 @@ function drupal_page_footer() { module_implements(MODULE_IMPLEMENTS_WRITE_CACHE); registry_cache_path_files(); + _registry_check_code(REGISTRY_CHECK_CODE_WRITE_CACHE); } /**