Skip to content

Commit

Permalink
MAGECLOUD-4264: Deliver patches for MSI
Browse files Browse the repository at this point in the history
  • Loading branch information
shiftedreality committed Oct 9, 2019
1 parent 6b8b33a commit 343c25e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Step/Deploy/PreDeploy/ConfigUpdate/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function execute()

if (isset($cacheConfig['frontend'])) {
$cacheConfig['frontend'] = array_filter($cacheConfig['frontend'], function ($cacheFrontend) {
return $cacheFrontend['backend'] != 'Cm_Cache_Backend_Redis'
return $cacheFrontend['backend'] !== 'Cm_Cache_Backend_Redis'
|| $this->testRedisConnection($cacheFrontend['backend_options']);
});
}
Expand All @@ -94,15 +94,20 @@ public function execute()
* @param array $backendOptions
*
* @return bool
* @throws StepException
*/
private function testRedisConnection(array $backendOptions): bool
{
if (!isset($backendOptions['server']) || !isset($backendOptions['port'])) {
if (!isset($backendOptions['server'], $backendOptions['port'])) {
throw new StepException('Missing required Redis configuration!');
}

$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
$connected = @socket_connect($sock, $backendOptions['server'], $backendOptions['port']);
$connected = @socket_connect(
$sock,
(string)$backendOptions['server'],
(int)$backendOptions['port']
);
socket_close($sock);

return $connected;
Expand Down

0 comments on commit 343c25e

Please sign in to comment.