summaryrefslogtreecommitdiff
path: root/includes/file.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-11-30 19:31:47 +0000
committerDries Buytaert <dries@buytaert.net>2010-11-30 19:31:47 +0000
commit1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd (patch)
tree2160f4d43f9da6385d200a04ee470c08b022c69e /includes/file.inc
parent96b74a1594456dc1879df03222656e0dec815ad6 (diff)
downloadbrdo-1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd.tar.gz
brdo-1fb5f62ba56bdbc6ff9f8a4045bccca8c5b9decd.tar.bz2
- Patch #651240 by fago, sun: allow modules to react to changes to an entity.
Diffstat (limited to 'includes/file.inc')
-rw-r--r--includes/file.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/includes/file.inc b/includes/file.inc
index 742c20e72..e8db63448 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -574,6 +574,11 @@ function file_save(stdClass $file) {
$file->timestamp = REQUEST_TIME;
$file->filesize = filesize($file->uri);
+ // Load the stored entity, if any.
+ if (!empty($file->fid) && !isset($file->original)) {
+ $file->original = entity_load_unchanged('file', $file->fid);
+ }
+
if (empty($file->fid)) {
drupal_write_record('file_managed', $file);
// Inform modules about the newly added file.
@@ -587,6 +592,7 @@ function file_save(stdClass $file) {
module_invoke_all('entity_update', $file, 'file');
}
+ unset($file->original);
return $file;
}