fix broken cache warmup after setup#974
Conversation
There was a problem hiding this comment.
Pull request overview
Invalidates the expression cache after setup to prevent warmup failures caused by stale generated classes.
Changes:
- Clears the expression-cache directory during environment commit.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
| Filename | Overview |
|---|---|
| setup/runtimeenv.class.inc.php | Adds a tidydir call to clear the expressioncache directory during Commit(), but uses utils::GetCachePath() without an explicit environment argument — in unattended/CLI setups this resolves to the build env cache path rather than the production one, making the fix a no-op. |
Reviews (1): Last reviewed commit: "fix broken cache warmup after setup" | Re-trigger Greptile
| false | ||
| ); | ||
|
|
||
| SetupUtils::tidydir(utils::GetCachePath().'expressioncache/'); |
There was a problem hiding this comment.
Wrong cache path in unattended/CLI setup
utils::GetCachePath() resolves the environment by calling MetaModel::GetEnvironment(), which returns whatever environment was last passed to MetaModel::Startup(). In the interactive wizard, the commit step runs in a fresh HTTP request where no Startup() has been called yet, so MetaModel::$m_sEnvironment falls back to the compile-time default 'production' — making this call work correctly.
In an unattended (CLI/all-in-one-request) setup, UpdateDBSchema() calls InitDataModel() earlier in the same process, which calls MetaModel::Startup(..., $this->sBuildEnv), setting MetaModel::$m_sEnvironment = 'production-build'. When Commit() reaches line 919, GetCachePath() returns data/cache-production-build/expressioncache/ — but that directory was already moved away by CommitDir at line 913. The tidydir is a no-op, the stale expressioncache in cache-production/ is never cleared, and the bug persists for unattended installs. Use utils::GetCachePath($this->sFinalEnv) to always target the correct directory.
| SetupUtils::tidydir(utils::GetCachePath().'expressioncache/'); | |
| SetupUtils::tidydir(utils::GetCachePath($this->sFinalEnv).'expressioncache/'); |
Fix below issue after setup: