aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2013-04-13 09:44:17 -0400
committerCash Costello <cash.costello@gmail.com>2013-04-13 09:44:17 -0400
commit6dac3f3be526a0fdc2aea05444ed3fe0d4e7bcf5 (patch)
tree20367a99ec9a8c30cfe6e411a99c9b043d082514
parent4b19f1801d29c6441b0f2aaa08ed834df1a0e056 (diff)
downloadelgg-6dac3f3be526a0fdc2aea05444ed3fe0d4e7bcf5.tar.gz
elgg-6dac3f3be526a0fdc2aea05444ed3fe0d4e7bcf5.tar.bz2
clear entity cache for the subpages that were promoted to pages
-rw-r--r--mod/pages/actions/pages/delete.php15
1 files changed, 9 insertions, 6 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php
index f6b25cd7e..c99f15fbf 100644
--- a/mod/pages/actions/pages/delete.php
+++ b/mod/pages/actions/pages/delete.php
@@ -21,30 +21,33 @@ if (elgg_instanceof($page, 'object', 'page') || elgg_instanceof($page, 'object',
'metadata_value' => $page->getGUID()
));
if ($children) {
+ $db_prefix = elgg_get_config('dbprefix');
+ $subtype_id = (int)get_subtype_id('object', 'page_top');
+ $newentity_cache = is_memcache_available() ? new ElggMemcache('new_entity_cache') : null;
+
foreach ($children as $child) {
if ($parent) {
$child->parent_guid = $parent;
} else {
// If no parent, we need to transform $child to a page_top
- $db_prefix = elgg_get_config('dbprefix');
- $subtype_id = (int)get_subtype_id('object', 'page_top');
$child_guid = (int)$child->guid;
+
update_data("UPDATE {$db_prefix}entities
SET subtype = $subtype_id WHERE guid = $child_guid");
+
elgg_delete_metadata(array(
'guid' => $child_guid,
'metadata_name' => 'parent_guid',
));
- // If memcache is available, delete this entry from the cache
- if (is_memcache_available()) {
- $newentity_cache = new ElggMemcache('new_entity_cache');
+ invalidate_cache_for_entity($child_guid);
+ if ($newentity_cache) {
$newentity_cache->delete($child_guid);
}
}
}
}
-
+
if ($page->delete()) {
system_message(elgg_echo('pages:delete:success'));
if ($parent) {