diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-02-27 07:41:34 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-02-27 07:41:34 +0000 |
commit | 1a817fd2f8be7bee18f455e65ca7f3f10ae5d633 (patch) | |
tree | 2729d9acc404b225b789ad00f0f695ff9d3fa1b9 /includes/common.inc | |
parent | bb5dc9d0c4f2636ee01d43e71ccf2580deb0b0bb (diff) | |
download | brdo-1a817fd2f8be7bee18f455e65ca7f3f10ae5d633.tar.gz brdo-1a817fd2f8be7bee18f455e65ca7f3f10ae5d633.tar.bz2 |
- Patch #503550 by yched, jp.stacey: make sure strings are cached per language.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc index 60081e73a..eb72bc311 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6197,6 +6197,8 @@ function drupal_check_incompatibility($v, $current_version) { * to return an array with info about all types. */ function entity_get_info($entity_type = NULL) { + global $language; + // Use the advanced drupal_static() pattern, since this is called very often. static $drupal_static_fast; if (!isset($drupal_static_fast)) { @@ -6204,8 +6206,12 @@ function entity_get_info($entity_type = NULL) { } $entity_info = &$drupal_static_fast['entity_info']; + // hook_entity_info() includes translated strings, so each language is cached + // separately. + $langcode = $language->language; + if (empty($entity_info)) { - if ($cache = cache_get('entity_info')) { + if ($cache = cache_get("entity_info:$langcode")) { $entity_info = $cache->data; } else { @@ -6235,7 +6241,7 @@ function entity_get_info($entity_type = NULL) { } // Let other modules alter the entity info. drupal_alter('entity_info', $entity_info); - cache_set('entity_info', $entity_info); + cache_set("entity_info:$langcode", $entity_info); } } @@ -6252,7 +6258,8 @@ function entity_get_info($entity_type = NULL) { */ function entity_info_cache_clear() { drupal_static_reset('entity_get_info'); - cache_clear_all('entity_info', 'cache'); + // Clear all languages. + cache_clear_all('entity_info:', 'cache', TRUE); } /** |