From 35c39df3d382f5e79d8833bebcfaeb4041c9c3e6 Mon Sep 17 00:00:00 2001 From: brettp Date: Fri, 29 Jan 2010 19:02:21 +0000 Subject: Fixes #1470, Fixes #1471: elgg_view_regenerate_simplecache() no longer triggers the pagesetup/system hook. Fixes problems with creating the submenu. git-svn-id: http://code.elgg.org/elgg/trunk@3855 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/elgglib.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'engine') diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 021af5e48..4c45da6e9 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -375,6 +375,14 @@ function elgg_view_register_simplecache($viewname) { function elgg_view_regenerate_simplecache() { global $CONFIG; + // @todo elgg_view() checks if the page set is done (isset($CONFIG->pagesetupdone)) and + // triggers an event if it's not. Calling elgg_view() here breaks submenus + // (at least) because the page setup hook is called before any + // contexts can be correctly set (since this is called before page_handler()). + // To avoid this, lie about $CONFIG->pagehandlerdone to force + // the trigger correctly when the first view is actually being output. + $CONFIG->pagesetupdone = TRUE; + if (isset($CONFIG->views->simplecache)) { if (!file_exists($CONFIG->dataroot . 'views_simplecache')) { @mkdir($CONFIG->dataroot . 'views_simplecache'); @@ -391,8 +399,10 @@ function elgg_view_regenerate_simplecache() { } } - datalist_set('simplecache_lastupdate', 0); + datalist_set('simplecache_lastupdate', 0); } + + unset($CONFIG->pagesetupdone); } /** -- cgit v1.2.3