mirror of
https://github.com/glowingblue/flarum-ext-redis-setup.git
synced 2026-03-22 06:57:45 +01:00
Compare commits
4 Commits
1.3.0
...
sh/redis-s
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
078fd9a746 | ||
|
|
4f261dbee4 | ||
|
|
d59ebfa684 | ||
|
|
b03ca35d54 |
2
.github/workflows/backend.yml
vendored
2
.github/workflows/backend.yml
vendored
@@ -8,6 +8,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
enable_backend_testing: false
|
enable_backend_testing: false
|
||||||
enable_phpstan: true
|
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: .
|
backend_directory: .
|
||||||
|
|||||||
6
.github/workflows/frontend.yml
vendored
6
.github/workflows/frontend.yml
vendored
@@ -13,7 +13,11 @@ jobs:
|
|||||||
frontend_directory: ./js
|
frontend_directory: ./js
|
||||||
backend_directory: .
|
backend_directory: .
|
||||||
js_package_manager: yarn
|
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:
|
secrets:
|
||||||
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
bundlewatch_github_token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}
|
||||||
|
git_actor_token: ${{ secrets.GIT_ACTOR_TOKEN }}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://glowingblue.com",
|
"homepage": "https://glowingblue.com",
|
||||||
"require": {
|
"require": {
|
||||||
|
"php": "^8.1",
|
||||||
"flarum/core": "^1.8.5",
|
"flarum/core": "^1.8.5",
|
||||||
"fof/redis": "^1.0"
|
"fof/redis": "^1.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ glowingblue-redis-setup:
|
|||||||
Enable Redis sessions (all users will be logged out after changing this setting)
|
Enable Redis sessions (all users will be logged out after changing this setting)
|
||||||
enable_queue: Enable Redis queue
|
enable_queue: Enable Redis queue
|
||||||
horizon_config: "Horizon config (format: JSON)."
|
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>
|
||||||
|
|||||||
@@ -24,13 +24,17 @@ class EnableRedis implements ExtenderInterface
|
|||||||
const CACHE_KEY = 'connections.cache';
|
const CACHE_KEY = 'connections.cache';
|
||||||
const QUEUE_KEY = 'connections.queue';
|
const QUEUE_KEY = 'connections.queue';
|
||||||
const SESSION_KEY = 'connections.session';
|
const SESSION_KEY = 'connections.session';
|
||||||
|
const SETTINGS_KEY = 'connections.settings';
|
||||||
|
|
||||||
public function extend(Container $container, Extension $extension = null)
|
public function extend(Container $container, Extension $extension = null)
|
||||||
{
|
{
|
||||||
$config = $this->buildConfig();
|
$config = $this->buildConfig();
|
||||||
|
|
||||||
(new Redis($config))
|
/** @var Redis $redis */
|
||||||
|
$redis = (new Redis($config))
|
||||||
->disable($this->getDisabledServices());
|
->disable($this->getDisabledServices());
|
||||||
|
|
||||||
|
$redis->extend($container, $extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisabledServices(): array
|
private function getDisabledServices(): array
|
||||||
@@ -42,6 +46,7 @@ class EnableRedis implements ExtenderInterface
|
|||||||
|
|
||||||
if (!(bool) $settings->get('glowingblue-redis.enableCache', false)) {
|
if (!(bool) $settings->get('glowingblue-redis.enableCache', false)) {
|
||||||
$disabled[] = 'cache';
|
$disabled[] = 'cache';
|
||||||
|
$disabled[] = 'settings';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(bool) $settings->get('glowingblue-redis.enableQueue', false)) {
|
if (!(bool) $settings->get('glowingblue-redis.enableQueue', false)) {
|
||||||
@@ -76,9 +81,14 @@ class EnableRedis implements ExtenderInterface
|
|||||||
'database' => static::getSessionDatabase(),
|
'database' => static::getSessionDatabase(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
$settings = $base + [
|
||||||
|
'database' => static::getSessionDatabase(),
|
||||||
|
];
|
||||||
|
|
||||||
$config = Arr::add($config, self::CACHE_KEY, $cache);
|
$config = Arr::add($config, self::CACHE_KEY, $cache);
|
||||||
$config = Arr::add($config, self::QUEUE_KEY, $queue);
|
$config = Arr::add($config, self::QUEUE_KEY, $queue);
|
||||||
$config = Arr::add($config, self::SESSION_KEY, $session);
|
$config = Arr::add($config, self::SESSION_KEY, $session);
|
||||||
|
$config = Arr::add($config, self::SETTINGS_KEY, $settings);
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user