mirror of
https://github.com/glowingblue/flarum-ext-redis-setup.git
synced 2026-03-22 06:57:45 +01:00
* chore: migrate to fof/redis, repo maintenance * chore: newline * chore: use new fof horizon initializer * chore: revert initializer change Only changed for 2.x .. * chore: remove unused secrets Shouldn't have been added in the first place --------- Co-authored-by: Davide Iadeluca <146922689+DavideIadeluca@users.noreply.github.com> Co-authored-by: Davide Iadeluca <davide.iadeluca@glowingblue.com>
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of glowingblue/redis-setup.
|
|
*
|
|
* Copyright (c) 2022 Glowing Blue AG.
|
|
* Authors: Rafael Horvat.
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE.md
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace GlowingBlue\RedisSetup\Extend;
|
|
|
|
use FoF\Horizon\Extend\Horizon;
|
|
use Flarum\Extend\ExtenderInterface;
|
|
use Flarum\Extension\Extension;
|
|
use Flarum\Extension\ExtensionManager;
|
|
use Flarum\Settings\SettingsRepositoryInterface;
|
|
use Illuminate\Contracts\Container\Container;
|
|
|
|
class ConfigureHorizon implements ExtenderInterface
|
|
{
|
|
public function extend(Container $container, Extension $extension = null)
|
|
{
|
|
$extensions = resolve(ExtensionManager::class);
|
|
|
|
if (!$extensions->isEnabled('fof-horizon') || !class_exists(Horizon::class)) {
|
|
return;
|
|
}
|
|
|
|
/** @var SettingsRepositoryInterface */
|
|
$settings = resolve(SettingsRepositoryInterface::class);
|
|
|
|
$config = json_decode($settings->get('glowingblue-redis.horizonConfig', '[]'), true);
|
|
|
|
if (!is_array($config) || empty($config)) {
|
|
return;
|
|
}
|
|
|
|
(new Horizon())
|
|
->config($config)
|
|
->extend($container, $extension);
|
|
}
|
|
}
|