From 1916f7858faea4cf8ac96101feafa883adb08891 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 7 Jun 2017 19:51:37 +0000 Subject: [PATCH 1/3] Increase the page load speed with Frio --- include/acl_selectors.php | 7 +++++++ view/theme/frio/theme.php | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index c7c6bb206a..9ef1977bc5 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -389,6 +389,13 @@ function populate_acl($user = null, $show_jotnets = false) { function construct_acl_data(App $a, $user) { + $arr = array('user' => $user); + call_hooks('construct_acl_data', $arr); + + if (isset($arr['cancel'])) { + return; + } + // Get group and contact information for html ACL selector $acl_data = acl_lookup($a, 'html'); diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index 551f39c8f7..cbb7324bcb 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -48,6 +48,7 @@ function frio_install() { register_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); register_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); register_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); + register_hook('construct_acl_data', 'view/theme/frio/theme.php', 'frio_construct_acl_data'); logger("installed theme frio"); } @@ -58,6 +59,7 @@ function frio_uninstall() { unregister_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); unregister_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); unregister_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); + unregister_hook('construct_acl_data', 'view/theme/frio/theme.php', 'frio_construct_acl_data'); logger("uninstalled theme frio"); } @@ -321,3 +323,15 @@ function frio_acl_lookup(App $a, &$results) { $results["tot"] = $total; } } + +/** + * @brief: Deactivate the old style acl selector + * + * We don't need the old one for Frio. Deactivating makes page loading much faster + * + * @param App $a The app data @TODO Unused + * @param array $arr We use this array to stop processing. See construct_acl_data in include/acl_selectors.php + */ +function frio_construct_acl_data(App $a, &$arr) { + $arr['cancel'] = true; +} From 0541a62134e8af948f0e4c713a42ca70eaa64f3f Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 8 Jun 2017 03:56:42 +0000 Subject: [PATCH 2/3] The function "construct_acl_data" isn't used at all, it seems. it is deactivated now --- include/acl_selectors.php | 10 +++------- view/theme/frio/theme.php | 14 -------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 9ef1977bc5..725f69a656 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -388,13 +388,9 @@ function populate_acl($user = null, $show_jotnets = false) { } function construct_acl_data(App $a, $user) { - - $arr = array('user' => $user); - call_hooks('construct_acl_data', $arr); - - if (isset($arr['cancel'])) { - return; - } + // This function is now deactivated. It seems as if the generated data isn't used anywhere. + // We will remove the function completely before the release of 3.5.3 when there won't be any issues. + return; // Get group and contact information for html ACL selector $acl_data = acl_lookup($a, 'html'); diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index cbb7324bcb..551f39c8f7 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -48,7 +48,6 @@ function frio_install() { register_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); register_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); register_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); - register_hook('construct_acl_data', 'view/theme/frio/theme.php', 'frio_construct_acl_data'); logger("installed theme frio"); } @@ -59,7 +58,6 @@ function frio_uninstall() { unregister_hook('contact_photo_menu', 'view/theme/frio/theme.php', 'frio_contact_photo_menu'); unregister_hook('nav_info', 'view/theme/frio/theme.php', 'frio_remote_nav'); unregister_hook('acl_lookup_end', 'view/theme/frio/theme.php', 'frio_acl_lookup'); - unregister_hook('construct_acl_data', 'view/theme/frio/theme.php', 'frio_construct_acl_data'); logger("uninstalled theme frio"); } @@ -323,15 +321,3 @@ function frio_acl_lookup(App $a, &$results) { $results["tot"] = $total; } } - -/** - * @brief: Deactivate the old style acl selector - * - * We don't need the old one for Frio. Deactivating makes page loading much faster - * - * @param App $a The app data @TODO Unused - * @param array $arr We use this array to stop processing. See construct_acl_data in include/acl_selectors.php - */ -function frio_construct_acl_data(App $a, &$arr) { - $arr['cancel'] = true; -} From 34815de99c548b61c94b6e6939edd485eca728d6 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 8 Jun 2017 21:00:45 +0000 Subject: [PATCH 3/3] Changed documentation --- include/acl_selectors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/acl_selectors.php b/include/acl_selectors.php index 725f69a656..ee5ad7fcc8 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -389,7 +389,7 @@ function populate_acl($user = null, $show_jotnets = false) { function construct_acl_data(App $a, $user) { // This function is now deactivated. It seems as if the generated data isn't used anywhere. - // We will remove the function completely before the release of 3.5.3 when there won't be any issues. + /// @todo Remove this function and all function calls before releasing Friendica 3.5.3 return; // Get group and contact information for html ACL selector