aboutsummaryrefslogtreecommitdiff
path: root/engine/classes/ElggEntity.php
diff options
context:
space:
mode:
authorSteve Clay <steve@mrclay.org>2013-06-07 09:52:48 -0400
committerSteve Clay <steve@mrclay.org>2013-06-07 09:52:48 -0400
commit46ace645c75dbbaad4b2cdaeedffcd501487aa93 (patch)
treef723f7c443dbbbbff5c204e631e81a46fbd4f712 /engine/classes/ElggEntity.php
parente04a851de79007adfb1c2c7a81f0cece95ae6441 (diff)
downloadelgg-46ace645c75dbbaad4b2cdaeedffcd501487aa93.tar.gz
elgg-46ace645c75dbbaad4b2cdaeedffcd501487aa93.tar.bz2
Fixes #5600: Entities are kept out of entity cache during save
Diffstat (limited to 'engine/classes/ElggEntity.php')
-rw-r--r--engine/classes/ElggEntity.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/engine/classes/ElggEntity.php b/engine/classes/ElggEntity.php
index 8b3ceb551..dd1c7c114 100644
--- a/engine/classes/ElggEntity.php
+++ b/engine/classes/ElggEntity.php
@@ -1270,15 +1270,23 @@ abstract class ElggEntity extends ElggData implements
public function save() {
$guid = $this->getGUID();
if ($guid > 0) {
- _elgg_cache_entity($this);
- return update_entity(
+ // See #5600. This ensures the lower level can_edit_entity() check will use a
+ // fresh entity from the DB so it sees the persisted owner_guid
+ _elgg_disable_caching_for_entity($guid);
+
+ $ret = update_entity(
$guid,
$this->get('owner_guid'),
$this->get('access_id'),
$this->get('container_guid'),
$this->get('time_created')
);
+
+ _elgg_enable_caching_for_entity($guid);
+ _elgg_cache_entity($this);
+
+ return $ret;
} else {
// Create a new entity (nb: using attribute array directly
// 'cos set function does something special!)