Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
imorland committed Jul 5, 2021
1 parent 68af330 commit 3284a36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
4 changes: 2 additions & 2 deletions extend.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace GlowingBlue\RedisSetup;

use Flarum\Extend;
use GlowingBlue\RedisSetup\Extend\EnableRedis;
use GlowingBlue\RedisSetup\Extend as GBExtend;
use GlowingBlue\RedisSetup\Provider\QueueProvider;

return [
Expand All @@ -21,7 +21,7 @@

new Extend\Locales(__DIR__.'/resources/locale'),

new EnableRedis(),
new GBExtend\EnableRedis(),

(new Extend\ServiceProvider())
->register(QueueProvider::class),
Expand Down
19 changes: 4 additions & 15 deletions src/Extend/EnableRedis.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,10 @@ class EnableRedis implements ExtenderInterface
public function extend(Container $container, Extension $extension = null)
{
$config = $this->buildConfig();
$disabled = $this->getDisabledServices();

$redis = (new Redis($config));

foreach ($disabled as $service) {
$redis->disable($service);
}

$redis->extend($container, $extension);
(new Redis($config))
->disable($this->getDisabledServices())
->extend($container, $extension);
}

private function getDisabledServices(): array
Expand All @@ -51,14 +46,8 @@ private function getDisabledServices(): array
return $disabled;
}

private function buildConfig(): array
private function buildConfig($config = []): array
{
if ($this->getHost() === null) {
return [];
}

$config = [];

$cache = [
'host' => $this->getHost(),
'password' => $this->getPassword(),
Expand Down

0 comments on commit 3284a36

Please sign in to comment.