4 Commits

Author SHA1 Message Date
Simon Hiller
078fd9a746 feat: implement settings config 2026-02-25 12:45:04 +01:00
Davide Iadeluca
4f261dbee4 chore: adjust workflows
[skip ci]
2025-11-30 11:51:35 +01:00
IanM
d59ebfa684 fix: extend not called (#5)
Some checks failed
GB Redis Setup PHP / run (push) Has been cancelled
GB Redis Setup JS / run (push) Has been cancelled
* fix: extend not called

* chore: phpstan
2025-11-18 22:01:50 +00:00
IanM
b03ca35d54 Extend Redis functionality with new method 2025-11-18 20:44:52 +00:00
5 changed files with 19 additions and 4 deletions

View File

@@ -8,6 +8,6 @@ jobs:
with:
enable_backend_testing: false
enable_phpstan: true
php_versions: '["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]'
php_versions: '["8.1", "8.2", "8.3", "8.4"]'
backend_directory: .

View File

@@ -13,7 +13,11 @@ jobs:
frontend_directory: ./js
backend_directory: .
js_package_manager: yarn
main_git_branch: master
main_git_branch: 1.x
git_actor_name: ${{ vars.GIT_ACTOR_NAME }}
git_actor_email: ${{ vars.GIT_ACTOR_EMAIL }}
secrets:
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
git_actor_token: ${{ secrets.GIT_ACTOR_TOKEN }}

View File

@@ -18,6 +18,7 @@
},
"homepage": "https://glowingblue.com",
"require": {
"php": "^8.1",
"flarum/core": "^1.8.5",
"fof/redis": "^1.0"
},

View File

@@ -6,4 +6,4 @@ glowingblue-redis-setup:
Enable Redis sessions (all users will be logged out after changing this setting)
enable_queue: Enable Redis queue
horizon_config: "Horizon config (format: JSON)."
horizon_help_text: This will be passed to <code>(new \Blomstra\Horizon\Extend\Horizon)->config(...))</code>
horizon_help_text: This will be passed to <code>(new \FoF\Horizon\Extend\Horizon)->config(...))</code>

View File

@@ -24,13 +24,17 @@ class EnableRedis implements ExtenderInterface
const CACHE_KEY = 'connections.cache';
const QUEUE_KEY = 'connections.queue';
const SESSION_KEY = 'connections.session';
const SETTINGS_KEY = 'connections.settings';
public function extend(Container $container, Extension $extension = null)
{
$config = $this->buildConfig();
(new Redis($config))
/** @var Redis $redis */
$redis = (new Redis($config))
->disable($this->getDisabledServices());
$redis->extend($container, $extension);
}
private function getDisabledServices(): array
@@ -42,6 +46,7 @@ class EnableRedis implements ExtenderInterface
if (!(bool) $settings->get('glowingblue-redis.enableCache', false)) {
$disabled[] = 'cache';
$disabled[] = 'settings';
}
if (!(bool) $settings->get('glowingblue-redis.enableQueue', false)) {
@@ -76,9 +81,14 @@ class EnableRedis implements ExtenderInterface
'database' => static::getSessionDatabase(),
];
$settings = $base + [
'database' => static::getSessionDatabase(),
];
$config = Arr::add($config, self::CACHE_KEY, $cache);
$config = Arr::add($config, self::QUEUE_KEY, $queue);
$config = Arr::add($config, self::SESSION_KEY, $session);
$config = Arr::add($config, self::SETTINGS_KEY, $settings);
return $config;
}