diff options
author | Sem <sembrestels@riseup.net> | 2012-07-08 13:23:40 +0200 |
---|---|---|
committer | cash <cash.costello@gmail.com> | 2013-03-30 14:40:04 -0400 |
commit | aa8af5035f0f7b2ed54eb42a136b58565e023c01 (patch) | |
tree | b056e6c985fc3079bd2e7b3d710bcadfb467cf5a /mod/pages/actions | |
parent | 7f01abbe8ec3dc8e7626639732fd095e264c27c5 (diff) | |
download | elgg-aa8af5035f0f7b2ed54eb42a136b58565e023c01.tar.gz elgg-aa8af5035f0f7b2ed54eb42a136b58565e023c01.tar.bz2 |
Fixes #1708. Moving up subpages when delete a page wasn't be applied in page_top subtype.
Diffstat (limited to 'mod/pages/actions')
-rw-r--r-- | mod/pages/actions/pages/delete.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mod/pages/actions/pages/delete.php b/mod/pages/actions/pages/delete.php index 7a314a280..fbb4cf551 100644 --- a/mod/pages/actions/pages/delete.php +++ b/mod/pages/actions/pages/delete.php @@ -23,6 +23,23 @@ if (elgg_instanceof($page, 'object', 'page') || elgg_instanceof($page, 'object', if ($children) { foreach ($children as $child) { $child->parent_guid = $parent; + + // If no parent, we need to transform $child in a page_top + if ($parent == 0) { + $dbprefix = elgg_get_config('dbprefix'); + $subtype_id = add_subtype('object', 'page_top'); + update_data("UPDATE {$dbprefix}entities + set subtype='$subtype_id' WHERE guid=$child->guid"); + + // If memcache is available then delete this entry from the cache + static $newentity_cache; + if ((!$newentity_cache) && (is_memcache_available())) { + $newentity_cache = new ElggMemcache('new_entity_cache'); + } + if ($newentity_cache) { + $newentity_cache->delete($guid); + } + } } } |