diff options
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r-- | engine/lib/entities.php | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 156f552f4..ff4487570 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -723,8 +723,7 @@ */
public function delete()
{
- $res = delete_entity($this->get('guid'));
- return $res;
+ return delete_entity($this->get('guid'));
}
// LOCATABLE INTERFACE /////////////////////////////////////////////////////////////
@@ -1845,7 +1844,23 @@ $entity->clearRelationships();
remove_from_river_by_subject($guid);
remove_from_river_by_object($guid);
- $res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
+ $res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}"); + if ($res) + { + $sub_table = ""; + + // Where appropriate delete the sub table + switch ($entity->type) + { + case 'object' : $sub_table = $CONFIG->dbprefix . 'objects_entity'; break; + case 'user' : $sub_table = $CONFIG->dbprefix . 'users_entity'; break; + case 'group' : $sub_table = $CONFIG->dbprefix . 'groups_entity'; break; + case 'site' : $sub_table = $CONFIG->dbprefix . 'sites_entity'; break; + } + + if ($sub_table) + delete_data("DELETE from $sub_table where guid={$guid}"); + }
return $res;
}
|