diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-02 02:29:48 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-04-02 02:29:48 +0000 |
commit | 9064861b7b3946aa16d73aa3975f4fe4d89a0d97 (patch) | |
tree | 2bc0b1faf3c50b879e310df01c41cb31d5788eca /engine/lib/entities.php | |
parent | da7dbb5d2d72d146dfdac71382afb63f2038432e (diff) | |
download | elgg-9064861b7b3946aa16d73aa3975f4fe4d89a0d97.tar.gz elgg-9064861b7b3946aa16d73aa3975f4fe4d89a0d97.tar.bz2 |
Fixes #3208 setting time_created on update
git-svn-id: http://code.elgg.org/elgg/trunk@8904 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index b862e177a..a4da347ec 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -367,12 +367,13 @@ function update_subtype($type, $subtype, $class = '') { * @param int $owner_guid The new owner guid * @param int $access_id The new access id * @param int $container_guid The new container guid + * @param int $time_created The time creation timestamp * * @return bool * @link http://docs.elgg.org/DataModel/Entities * @access private */ -function update_entity($guid, $owner_guid, $access_id, $container_guid = null) { +function update_entity($guid, $owner_guid, $access_id, $container_guid = null, $time_created = null) { global $CONFIG, $ENTITY_CACHE; $guid = (int)$guid; @@ -386,11 +387,18 @@ function update_entity($guid, $owner_guid, $access_id, $container_guid = null) { $entity = get_entity($guid); + if ($time_created == null) { + $time_created = $entity->time_created; + } else { + $time_created = (int) $time_created; + } + if ($entity && $entity->canEdit()) { if (elgg_trigger_event('update', $entity->type, $entity)) { - $ret = update_data("UPDATE {$CONFIG->dbprefix}entities" - . " set owner_guid='$owner_guid', access_id='$access_id'," - . " container_guid='$container_guid', time_updated='$time' WHERE guid=$guid"); + $ret = update_data("UPDATE {$CONFIG->dbprefix}entities + set owner_guid='$owner_guid', access_id='$access_id', + container_guid='$container_guid', time_created='$time_created', + time_updated='$time' WHERE guid=$guid"); if ($entity instanceof ElggObject) { update_river_access_by_object($guid, $access_id); |