PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
← All changes | app/Modules/Turnstile/TurnstileInit.php +11 -6 1.5.3 → 1.7.0 View file →
@@ -34,13 +34,18 @@
34 34
35 35 return $values;
36 36 }, 10, 2);
37 37
38 - // Boot the module if active
39 - $isActive = ModuleSettings::isActive('turnstile');
40 -
41 - if ($isActive) {
42 - (new TurnstileBoot())->register();
43 - }
38 + // Boot the module if active.
39 + // Deferred to `init` on purpose: ModuleSettings::getAllSettings() memoizes on its
40 + // first call, and that is where `module_setting/default_values` is applied. Reading
41 + // settings here would freeze the cache before modules registered later in
42 + // Hooks/actions.php add their own defaults, leaving those modules permanently
43 + // inactive. Every module must read settings after registration has finished.
44 + add_action('init', function () {
45 + if (ModuleSettings::isActive('turnstile')) {
46 + (new TurnstileBoot())->register();
47 + }
48 + }, 1);
44 49 }
45 50 }
46 51