From 71c4e3ec62427e562965561f5a7b13aa64737595 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Wed, 15 Dec 2010 03:39:42 +0000 Subject: #968458 by Dave Reid, sun, fago: Add Missing hook_entity_presave(). --- modules/system/system.api.php | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'modules/system') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 3d73c0647..aed02ae2c 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -280,6 +280,18 @@ function hook_entity_load($entities, $type) { } } +/** + * Act on an entity before it is about to be created or updated. + * + * @param $entity + * The entity object. + * @param $type + * The type of entity being saved (i.e. node, user, comment). + */ +function hook_entity_presave($entity, $type) { + $entity->changed = REQUEST_TIME; +} + /** * Act on entities when inserted. * @@ -2545,7 +2557,7 @@ function hook_file_validate(&$file) { } /** - * Respond to a file being added. + * Act on a file being inserted or updated. * * This hook is called when a file has been added to the database. The hook * doesn't distinguish between files created as a result of a copy or those @@ -2556,6 +2568,23 @@ function hook_file_validate(&$file) { * * @see file_save() */ +function hook_file_presave($file) { + // Change the file timestamp to an hour prior. + $file->timestamp -= 3600; +} + +/** + * Respond to a file being added. + * + * This hook is called before a file has been added to the database. The hook + * doesn't distinguish between files created as a result of a copy or those + * created by an upload. + * + * @param $file + * The file that is about to be saved. + * + * @see file_save() + */ function hook_file_insert($file) { } -- cgit v1.2.3