Issue #2159549 by Dave Reid: File_save() and file_delete() do not clear entity controller cache.

merge-requests/26/head
David Rothstein 2014-05-05 14:40:18 -04:00
parent b852638c1b
commit ee60a20fc3
2 changed files with 7 additions and 0 deletions

View File

@ -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

View File

@ -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;