#910190 by sun: Remove schema cache from needlessly being loaded on all pages. Performance improvement.

merge-requests/26/head
Angie Byron 2010-09-15 04:34:27 +00:00
parent b1d2adf26a
commit a3bc10c4ab
3 changed files with 10 additions and 3 deletions

View File

@ -6689,6 +6689,14 @@ function entity_get_info($entity_type = NULL) {
if (empty($entity_info[$name]['entity keys']['bundle']) && empty($entity_info[$name]['bundles'])) {
$entity_info[$name]['bundles'] = array($name => array('label' => $entity_info[$name]['label']));
}
// Prepare entity schema fields SQL info for
// DrupalEntityControllerInterface::buildQuery().
if (isset($entity_info[$name]['base table'])) {
$entity_info[$name]['schema_fields_sql']['base table'] = drupal_schema_fields_sql($entity_info[$name]['base table']);
if (isset($entity_info[$name]['revision table'])) {
$entity_info[$name]['schema_fields_sql']['revision table'] = drupal_schema_fields_sql($entity_info[$name]['revision table']);
}
}
}
// Let other modules alter the entity info.
drupal_alter('entity_info', $entity_info);

View File

@ -251,11 +251,11 @@ class DrupalDefaultEntityController implements DrupalEntityControllerInterface {
}
// Add fields from the {entity} table.
$entity_fields = drupal_schema_fields_sql($this->entityInfo['base table']);
$entity_fields = $this->entityInfo['schema_fields_sql']['base table'];
if ($this->revisionKey) {
// Add all fields from the {entity_revision} table.
$entity_revision_fields = drupal_map_assoc(drupal_schema_fields_sql($this->revisionTable));
$entity_revision_fields = drupal_map_assoc($this->entityInfo['schema_fields_sql']['revision table']);
// The id field is provided by entity, so remove it.
unset($entity_revision_fields[$this->idKey]);

View File

@ -13,7 +13,6 @@ function entity_cache_test_dependency_entity_info() {
return array(
'entity_cache_test' => array(
'label' => 'Entity Cache Test',
'base table' => 'entity_cache_test',
),
);
}