Skip to content

Instantly share code, notes, and snippets.

@alpharder
Created May 22, 2015 22:07
Show Gist options
  • Save alpharder/021efa08c094610f6e91 to your computer and use it in GitHub Desktop.
Save alpharder/021efa08c094610f6e91 to your computer and use it in GitHub Desktop.
diff --git a/app/functions/fn.control.php b/app/functions/fn.control.php
index 9510cae..4e47ca4 100644
--- a/app/functions/fn.control.php
+++ b/app/functions/fn.control.php
@@ -38,19 +38,26 @@ define('GET_POST_CONTROLLERS', 3);
function fn_set_hook($hook_name = NULL, &$arg1 = NULL, &$arg2 = NULL, &$arg3 = NULL, &$arg4 = NULL, &$arg5 = NULL, &$arg6 = NULL, &$arg7 = NULL, &$arg8 = NULL, &$arg9 = NULL, &$arg10 = NULL, &$arg11 = NULL, &$arg12 = NULL, &$arg13 = NULL, &$arg14 = NULL, &$arg15 = NULL)
{
static $callable_functions;
- static $hooks_already_sorted;
- static $edition_acronym;
+ static $hooks_already_sorted = array();
static $hooks = null;
static $addons_initiated = false;
- if (!$addons_initiated) {
+ if ($addons_initiated) {
+ $load_hooks_from_cache = true;
+ } else {
$addons_initiated = Registry::get('addons_initiated');
+ $load_hooks_from_cache = false;
}
- if ($hooks === null || !$addons_initiated || defined('DISABLE_HOOK_CACHE')) {
+ if (
+ $hooks === null
+ || !$load_hooks_from_cache
+ || defined('DISABLE_HOOK_CACHE')
+ ) {
$hooks = Registry::get('hooks');
+ $hooks_already_sorted = array();
}
$arg_count = func_num_args();
diff --git a/app/functions/fn.init.php b/app/functions/fn.init.php
index bff24b6..4458d20 100644
--- a/app/functions/fn.init.php
+++ b/app/functions/fn.init.php
@@ -852,7 +852,7 @@ function fn_init_addons()
}
}
- Registry::set('addons_initiated', true);
+ Registry::set('addons_initiated', true, true);
return array(INIT_STATUS_OK);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment