From 7d5aa488517bc1a1f721c56cac6ae7bab4de1ee1 Mon Sep 17 00:00:00 2001 From: Benjamin Walker Date: Fri, 11 Apr 2025 16:01:11 +1000 Subject: [PATCH] Set STATE_INITIALISING before loading config #68 --- classes/cache_factory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/cache_factory.php b/classes/cache_factory.php index 5f2466d..593afa7 100644 --- a/classes/cache_factory.php +++ b/classes/cache_factory.php @@ -55,6 +55,10 @@ public function create_config_instance($writer = false) { if (!array_key_exists($class, $this->configs)) { // Create a new instance and call it to load it. + // As part of generating store instance config we test the initialisation of stores. + // Testing this may initialise DI, which will attempt to use cache for hookcallbacks. + // Setting the state to initialising will make it use ad-hoc cache for that request. + self::set_state(self::STATE_INITIALISING); $this->configs[$class] = new $class; $this->configs[$class]->load(); } @@ -67,7 +71,7 @@ public function create_config_instance($writer = false) { $this->set_state(self::STATE_STORES_DISABLED); } else { // We cannot directly set the state to enabled from disabled. - // So we instead start and finish an update. + // So we instead start and finish an update to set STATE_READY. $this->updating_started(); $this->updating_finished(); }