summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/common.inc13
-rw-r--r--modules/field/field.info.inc12
-rw-r--r--modules/image/image.module12
3 files changed, 28 insertions, 9 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);
}
/**
diff --git a/modules/field/field.info.inc b/modules/field/field.info.inc
index 1e949b6c7..c7250eed5 100644
--- a/modules/field/field.info.inc
+++ b/modules/field/field.info.inc
@@ -65,18 +65,24 @@ function field_info_cache_clear() {
* as well as module, giving the module that exposes the entity type.
*/
function _field_info_collate_types($reset = FALSE) {
+ global $language;
static $info;
// @TODO use entity_get_info().
+ // The _info() hooks invoked below include translated strings, so each
+ // language is cached separately.
+ $langcode = $language->language;
+
if ($reset) {
$info = NULL;
- cache_clear_all('field_info_types', 'cache_field');
+ // Clear all languages.
+ cache_clear_all('field_info_types:', 'cache_field', TRUE);
return;
}
if (!isset($info)) {
- if ($cached = cache_get('field_info_types', 'cache_field')) {
+ if ($cached = cache_get("field_info_types:$langcode", 'cache_field')) {
$info = $cached->data;
}
else {
@@ -144,7 +150,7 @@ function _field_info_collate_types($reset = FALSE) {
}
drupal_alter('field_storage_info', $info['storage types']);
- cache_set('field_info_types', $info, 'cache_field');
+ cache_set("field_info_types:$langcode", $info, 'cache_field');
}
}
diff --git a/modules/image/image.module b/modules/image/image.module
index 8df106d8f..3d6cb2d65 100644
--- a/modules/image/image.module
+++ b/modules/image/image.module
@@ -694,7 +694,7 @@ function image_style_flush($style) {
// Clear image style and effect caches.
cache_clear_all('image_styles', 'cache');
- cache_clear_all('image_effects', 'cache');
+ cache_clear_all('image_effects:', 'cache', TRUE);
drupal_static_reset('image_styles');
drupal_static_reset('image_effects');
@@ -825,10 +825,16 @@ function image_default_style_revert($style) {
* @see image_effect_definition_load()
*/
function image_effect_definitions() {
+ global $language;
+
+ // hook_image_effect_info() includes translated strings, so each language is
+ // cached separately.
+ $langcode = $language->language;
+
$effects = &drupal_static(__FUNCTION__);
if (!isset($effects)) {
- if ($cache = cache_get('image_effects') && !empty($cache->data)) {
+ if ($cache = cache_get("image_effects:$langcode") && !empty($cache->data)) {
$effects = $cache->data;
}
else {
@@ -844,7 +850,7 @@ function image_effect_definitions() {
};
}
uasort($effects, '_image_effect_definitions_sort');
- cache_set('image_effects', $effects);
+ cache_set("image_effects:$langcode", $effects);
}
}