aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-05-29 07:52:19 -0400
committerCash Costello <cash.costello@gmail.com>2013-05-29 07:52:19 -0400
commit07d533b21c2433c43fe8b36504d38debcfdb3920 (patch)
tree04e2add9c0096c5da10ac081644ec28ebd16fb34
parent371e64beb9d47e0b64ce74d83a8587a73908f7d5 (diff)
downloadelgg-07d533b21c2433c43fe8b36504d38debcfdb3920.tar.gz
elgg-07d533b21c2433c43fe8b36504d38debcfdb3920.tar.bz2
Fixes #5551 removes corrupt entities from database
-rw-r--r--engine/lib/entities.php15
1 files changed, 11 insertions, 4 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 15ab1170e..7b4e0e15a 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -2470,11 +2470,18 @@ function update_entity_last_action($guid, $posted = NULL) {
function entities_gc() {
global $CONFIG;
- $tables = array ('sites_entity', 'objects_entity', 'groups_entity', 'users_entity');
+ $tables = array(
+ 'site' => 'sites_entity',
+ 'object' => 'objects_entity',
+ 'group' => 'groups_entity',
+ 'user' => 'users_entity'
+ );
- foreach ($tables as $table) {
- delete_data("DELETE from {$CONFIG->dbprefix}{$table}
- where guid NOT IN (SELECT guid from {$CONFIG->dbprefix}entities)");
+ foreach ($tables as $type => $table) {
+ delete_data("DELETE FROM {$CONFIG->dbprefix}{$table}
+ WHERE guid NOT IN (SELECT guid FROM {$CONFIG->dbprefix}entities)");
+ delete_data("DELETE FROM {$CONFIG->dbprefix}entities
+ WHERE type = '$type' AND guid NOT IN (SELECT guid FROM {$CONFIG->dbprefix}{$table})");
}
}