diff --git a/cache.inc.php b/cache.inc.php index f7e4ba9..6521d66 100644 --- a/cache.inc.php +++ b/cache.inc.php @@ -243,6 +243,9 @@ function _config_cache_fetch(ConfigFetchParams $params) : ConfigFetchResult if($params->scanned->isEmpty()) return new ConfigFetchResult(); + //TODO: not sure if it's the best place for this one + $GLOBALS['CONFIG_GLOBALS'] = $params->globals; + $params->scanned->apply(function($base_dir, $files) { sort($files); return $files;}); $jobs = $params->splitJobs(); @@ -354,7 +357,6 @@ function _config_invalidate_cache(ConfigFetchParams $params, string $base_dir, s throw new Exception("Bad conf id: {$conf_id}"); //TODO: this is a bit ugly but kinda works for now - $GLOBALS['CONFIG_GLOBALS'] = $params->globals; $GLOBALS['CONFIG_CURRENT_FILE'] = $file; $GLOBALS['CONFIG_CURRENT_PROTO_ID'] = $conf_id; $GLOBALS['CONFIG_EXTRAS'] = ConfigCacheEntryExtras::create(); diff --git a/config.inc.php b/config.inc.php index 467b07a..7f8c90b 100644 --- a/config.inc.php +++ b/config.inc.php @@ -25,6 +25,8 @@ class ConfigGlobals function initWorker() { + $GLOBALS['CONFIG_GLOBALS'] = $this; + if($this->worker_init_fn !== null) { $fn = $this->worker_init_fn;