summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2014-05-05 14:40:18 -0400
committerDavid Rothstein <drothstein@gmail.com>2014-05-05 14:40:18 -0400
commitee60a20fc3544497a0f37f9ce3846b2396a84263 (patch)
tree0bc8096288f2f3fb8263b6bf7932bffc0232c8ab
parentb852638c1b31da62f9ab86918ac0c2a8d06af2f4 (diff)
downloadbrdo-ee60a20fc3544497a0f37f9ce3846b2396a84263.tar.gz
brdo-ee60a20fc3544497a0f37f9ce3846b2396a84263.tar.bz2
Issue #2159549 by Dave Reid: File_save() and file_delete() do not clear entity controller cache.
-rw-r--r--CHANGELOG.txt2
-rw-r--r--includes/file.inc5
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ef65b506c..62666c148 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,8 @@
Drupal 7.28, xxxx-xx-xx (development version)
-----------------------
+- Fixed a bug which caused caches not to be properly cleared when a file entity
+ was saved or deleted.
- Added several missing countries to the default list returned by
country_get_list() (string change).
- Replaced the term "weight" with "influence" in the content ranking settings
diff --git a/includes/file.inc b/includes/file.inc
index ee6ce5181..834699f18 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -621,7 +621,11 @@ function file_save(stdClass $file) {
module_invoke_all('entity_update', $file, 'file');
}
+ // Clear internal properties.
unset($file->original);
+ // Clear the static loading cache.
+ entity_get_controller('file')->resetCache(array($file->fid));
+
return $file;
}
@@ -1293,6 +1297,7 @@ function file_delete(stdClass $file, $force = FALSE) {
if (file_unmanaged_delete($file->uri)) {
db_delete('file_managed')->condition('fid', $file->fid)->execute();
db_delete('file_usage')->condition('fid', $file->fid)->execute();
+ entity_get_controller('file')->resetCache();
return TRUE;
}
return FALSE;