mirror of
https://github.com/glowingblue/flarum-ext-redis-setup.git
synced 2026-03-22 06:57:45 +01:00
fix: disable fof/redis settings cache to avoid circular boot dependency (#7)
fof/redis >=1.1 introduces a `settings` service that replaces SettingsRepositoryInterface with a Redis-backed caching layer. Enabling it here creates a circular dependency: this extension reads settings to decide which Redis services to enable, but with the settings cache active those reads require Redis to already be wired. Always disable the `settings` service when delegating to fof/redis. Also fixes a cast-precedence bug in the database env var helpers where `(int) getenv(...) ? getenv(...) : N` applied the cast to the ternary condition rather than the result, causing REDIS_DATABASE_*=0 to return the default instead of 0. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,14 @@ composer update glowingblue/redis-setup
|
||||
php flarum cache:clear
|
||||
```
|
||||
|
||||
## Compatibility with `fof/redis`
|
||||
|
||||
This extension depends on [`fof/redis`](https://github.com/FriendsOfFlarum/redis) and deliberately disables the **`settings` service** that `fof/redis` ≥ 1.1 provides.
|
||||
|
||||
`fof/redis`'s settings service replaces Flarum's `SettingsRepositoryInterface` with a Redis-backed caching layer. However, this extension reads settings (e.g. which Redis services to enable) during its own boot sequence — *before* Redis is fully wired into the container. Enabling the Redis settings cache here would create a circular dependency: configuring Redis requires reading settings, but reading settings requires Redis.
|
||||
|
||||
The `settings` service from `fof/redis` is therefore always disabled in this extension's extender. If you want Redis-backed settings caching, configure `fof/redis` directly in your project's root `extend.php` instead of using this extension.
|
||||
|
||||
## 🔗 Links
|
||||
|
||||
- [Flarum Discuss post](https://discuss.flarum.org/d/27455)
|
||||
|
||||
Reference in New Issue
Block a user