forked from clone/flarum-ext-redis-setup
Cleanup
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
namespace GlowingBlue\RedisSetup;
|
namespace GlowingBlue\RedisSetup;
|
||||||
|
|
||||||
use Flarum\Extend;
|
use Flarum\Extend;
|
||||||
use GlowingBlue\RedisSetup\Extend\EnableRedis;
|
use GlowingBlue\RedisSetup\Extend as GBExtend;
|
||||||
use GlowingBlue\RedisSetup\Provider\QueueProvider;
|
use GlowingBlue\RedisSetup\Provider\QueueProvider;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
@@ -21,7 +21,7 @@ return [
|
|||||||
|
|
||||||
new Extend\Locales(__DIR__.'/resources/locale'),
|
new Extend\Locales(__DIR__.'/resources/locale'),
|
||||||
|
|
||||||
new EnableRedis(),
|
new GBExtend\EnableRedis(),
|
||||||
|
|
||||||
(new Extend\ServiceProvider())
|
(new Extend\ServiceProvider())
|
||||||
->register(QueueProvider::class),
|
->register(QueueProvider::class),
|
||||||
|
|||||||
@@ -18,15 +18,10 @@ class EnableRedis implements ExtenderInterface
|
|||||||
public function extend(Container $container, Extension $extension = null)
|
public function extend(Container $container, Extension $extension = null)
|
||||||
{
|
{
|
||||||
$config = $this->buildConfig();
|
$config = $this->buildConfig();
|
||||||
$disabled = $this->getDisabledServices();
|
|
||||||
|
|
||||||
$redis = (new Redis($config));
|
|
||||||
|
|
||||||
foreach ($disabled as $service) {
|
(new Redis($config))
|
||||||
$redis->disable($service);
|
->disable($this->getDisabledServices())
|
||||||
}
|
->extend($container, $extension);
|
||||||
|
|
||||||
$redis->extend($container, $extension);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getDisabledServices(): array
|
private function getDisabledServices(): array
|
||||||
@@ -51,14 +46,8 @@ class EnableRedis implements ExtenderInterface
|
|||||||
return $disabled;
|
return $disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function buildConfig(): array
|
private function buildConfig($config = []): array
|
||||||
{
|
{
|
||||||
if ($this->getHost() === null) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$config = [];
|
|
||||||
|
|
||||||
$cache = [
|
$cache = [
|
||||||
'host' => $this->getHost(),
|
'host' => $this->getHost(),
|
||||||
'password' => $this->getPassword(),
|
'password' => $this->getPassword(),
|
||||||
|
|||||||
Reference in New Issue
Block a user