#3277 closed Defect (fixed)
delete_entity function fails
| Reported by: | kevinjardine | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.7.8 |
| Component: | Core | Version: | 1.7 |
| Severity: | major | Keywords: | |
| Cc: | brett@… | Difficulty: | easy |
Description
A client reported that deleting a user failed. An investigation suggests that this is because the user owned disabled entities.
A look at the core delete_entity() function suggests a reason - the entities to delete are generated using raw SQL but this then recurses to individual get_entity() calls. The raw SQL returns the disabled entities but the get_entity calls are unable to access the disabled content and the overall delete fails.
Suggested fix - add:
access_show_hidden_entities(TRUE);
to delete_entity().
Change History (3)
comment:1 Changed 2 years ago by cash
- Difficulty set to easy
- Milestone changed from Needs Review to Elgg 1.7.8
comment:2 Changed 2 years ago by cash
- Resolution set to fixed
- Status changed from new to closed
(In [svn:8908]) Fixes #3277 supporting deleting disabled entities in a recursive delete
comment:3 Changed 2 years ago by cash
(In [svn:8909]) Refs #3277 merged fix for recursive delete and disabled entities into trunk

I can confirm this problem:
IOException Object ( [message:protected] => Failed to load new ElggObject from GUID:629 [string:private] => exception 'IOException' with message 'Failed to load new ElggObject from GUID:629' in /var/www/engine/lib/objects.php:49 Stack trace: #0 /var/www/engine/lib/entities.php(1675): ElggObject->__construct(Object(stdClass)) #1 /var/www/engine/lib/database.php(272): entity_row_to_elggstar(Object(stdClass)) #2 /var/www/engine/lib/entities.php(2610): get_data('SELECT * from e...', 'entity_row_to_e...') #3 /var/www/engine/lib/entities.php(884): delete_entity('171') #4 /var/www/engine/lib/users.php(175): ElggEntity->delete() #5 /var/www/actions/admin/user/delete.php(21): ElggUser->delete() #6 /var/www/engine/lib/actions.php(65): include('/var/www/action...') #7 /var/www/engine/handlers/action_handler.php(16): action('admin/user/dele...')