diff options
Diffstat (limited to 'engine/lib/objects.php')
-rw-r--r-- | engine/lib/objects.php | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/engine/lib/objects.php b/engine/lib/objects.php index 1914744a6..7c14e8cee 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -235,17 +235,18 @@ if ($row)
{ // Core entities row exists and we have access to it - - $result = update_data("UPDATE {$CONFIG->dbprefix}objects_entity set title='$title', description='$description' where guid=$guid"); - if ($result!=false) - { - // Update succeeded, continue - $entity = get_entity($guid); - if (trigger_elgg_event('update',$entity->type,$entity)) { - return true; - } else { - delete_entity($guid); - } + if ($exists = get_data_row("select guid from {$CONFIG->dbprefix}objects_entity where guid = {$guid}")) { + $result = update_data("UPDATE {$CONFIG->dbprefix}objects_entity set title='$title', description='$description' where guid=$guid"); + if ($result!=false) + { + // Update succeeded, continue + $entity = get_entity($guid); + if (trigger_elgg_event('update',$entity->type,$entity)) { + return true; + } else { + $entity->delete(); + } + }
} else { |