diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-30 02:01:41 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-01-30 02:01:41 +0000 |
commit | 02c1eeee3fc904ecc7845902cc11ba545dd9466b (patch) | |
tree | eb0af2759c9e1d3ad8a83fef225df3e8ed28ba9c /includes | |
parent | b1d0d1340c2f63ed5e1c8ec8df8b9e70edfe49ce (diff) | |
download | brdo-02c1eeee3fc904ecc7845902cc11ba545dd9466b.tar.gz brdo-02c1eeee3fc904ecc7845902cc11ba545dd9466b.tar.bz2 |
#684202 by catch: Added Entity insert/delete/update hooks, to support caching.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/common.inc | 13 | ||||
-rw-r--r-- | includes/file.inc | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 20b0648c7..d04f938ea 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6575,6 +6575,19 @@ function entity_path($entity_type, $entity) { return $info['path callback']($entity); } } +/** + * Invokes entity insert/update hooks. + * + * @param $op + * One of 'insert' or 'update'. + * @param $entity_type + * The entity type; e.g. 'node' or 'user'. + * @param $entity + * The entity object being operated on. + */ +function entity_invoke($op, $entity_type, $entity) { + module_invoke_all('entity_' . $op, $entity, $entity_type); +} /** * Performs one or more XML-RPC request(s). diff --git a/includes/file.inc b/includes/file.inc index ccac9cabc..b03e9d4d9 100644 --- a/includes/file.inc +++ b/includes/file.inc @@ -512,11 +512,13 @@ function file_save(stdClass $file) { drupal_write_record('file', $file); // Inform modules about the newly added file. module_invoke_all('file_insert', $file); + entity_invoke('insert', 'file', $file); } else { drupal_write_record('file', $file, 'fid'); // Inform modules that the file has been updated. module_invoke_all('file_update', $file); + entity_invoke('update', 'file', $file); } return $file; |