diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ef65b506cc5..62666c148e8 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 ee6ce5181c5..834699f1876 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;