Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.756.2.107 diff -u -p -r1.756.2.107 common.inc --- includes/common.inc 15 Dec 2010 21:34:35 -0000 1.756.2.107 +++ includes/common.inc 29 Dec 2010 04:17:51 -0000 @@ -3259,29 +3259,39 @@ function drupal_common_theme() { function drupal_get_schema($table = NULL, $rebuild = FALSE) { static $schema = array(); - if (empty($schema) || $rebuild) { - // Try to load the schema from cache. - if (!$rebuild && $cached = cache_get('schema')) { - $schema = $cached->data; + // If a table is specified, try to load the individual cache entry for that + // table. + if (isset($table) && !$rebuild) { + if (isset($schema[$table])) { + return $schema[$table]; + } + else if ($cached = cache_get('schema:' . $table)) { + $schema[$table] = $cached->data; } - // Otherwise, rebuild the schema cache. else { - $schema = array(); - // Load the .install files to get hook_schema. - module_load_all_includes('install'); - - // Invoke hook_schema for all modules. - foreach (module_implements('schema') as $module) { - // Cast the result of hook_schema() to an array, as a NULL return value - // would cause array_merge() to set the $schema variable to NULL as well. - // That would break modules which use $schema further down the line. - $current = (array) module_invoke($module, 'schema'); - _drupal_initialize_schema($module, $current); - $schema = array_merge($schema, $current); + $rebuild = TRUE; + } + } + if (!isset($table) || $rebuild) { + $schema = array(); + // Load the .install files to get hook_schema. + module_load_all_includes('install'); + + // Invoke hook_schema for all modules. + foreach (module_implements('schema') as $module) { + // Cast the result of hook_schema() to an array, as a NULL return value + // would cause array_merge() to set the $schema variable to NULL as well. + // That would break modules which use $schema further down the line. + $current = (array) module_invoke($module, 'schema'); + _drupal_initialize_schema($module, $current); + $schema = array_merge($schema, $current); + } + + drupal_alter('schema', $schema); + if ($rebuild && !empty($schema)) { + foreach ($schema as $key => $definition) { + cache_set('schema:' . $key, $definition); } - - drupal_alter('schema', $schema); - cache_set('schema', $schema); } }