Skip to content

Commit d1df925

Browse files
MAGETWO-58594: Static Assets deployment throws errors when redis is used for cache after PR 389
code style fixes
1 parent de729f3 commit d1df925

File tree

2 files changed

+89
-76
lines changed

2 files changed

+89
-76
lines changed

app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © 2016 Magento. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Deploy\Console\Command;
87

98
use Magento\Framework\App\Utility\Files;
@@ -19,6 +18,8 @@
1918
use Magento\Framework\App\State;
2019
use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options;
2120
use Magento\Deploy\Model\DeployManager;
21+
use Magento\Framework\App\Cache;
22+
use Magento\Framework\App\Cache\Type\Dummy as DummyCache;
2223

2324
/**
2425
* Deploy static content command
@@ -29,7 +30,7 @@ class DeployStaticContentCommand extends Command
2930
/**
3031
* Key for dry-run option
3132
* @deprecated
32-
* @see Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN
33+
* @see \Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN
3334
*/
3435
const DRY_RUN_OPTION = 'dry-run';
3536

@@ -87,6 +88,7 @@ class DeployStaticContentCommand extends Command
8788
* @param ObjectManagerFactory $objectManagerFactory
8889
* @param Locale $validator
8990
* @param ObjectManagerInterface $objectManager
91+
* @throws \LogicException When the command name is empty
9092
*/
9193
public function __construct(
9294
ObjectManagerFactory $objectManagerFactory,
@@ -374,6 +376,7 @@ private function getDeployableEntities($entities, $includedEntities, $excludedEn
374376
/**
375377
* {@inheritdoc}
376378
* @throws \InvalidArgumentException
379+
* @throws LocalizedException
377380
*/
378381
protected function execute(InputInterface $input, OutputInterface $output)
379382
{
@@ -395,9 +398,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
395398
list ($deployableLanguages, $deployableAreaThemeMap, $requestedThemes)
396399
= $this->prepareDeployableEntities($filesUtil);
397400

398-
$output->writeln("Requested languages: " . implode(', ', $deployableLanguages));
399-
$output->writeln("Requested areas: " . implode(', ', array_keys($deployableAreaThemeMap)));
400-
$output->writeln("Requested themes: " . implode(', ', $requestedThemes));
401+
$output->writeln('Requested languages: ' . implode(', ', $deployableLanguages));
402+
$output->writeln('Requested areas: ' . implode(', ', array_keys($deployableAreaThemeMap)));
403+
$output->writeln('Requested themes: ' . implode(', ', $requestedThemes));
401404

402405
/** @var $deployManager DeployManager */
403406
$deployManager = $this->objectManager->create(
@@ -427,6 +430,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
427430

428431
/**
429432
* @param Files $filesUtil
433+
* @throws \InvalidArgumentException
430434
* @return array
431435
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
432436
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -484,20 +488,26 @@ private function prepareDeployableEntities($filesUtil)
484488
return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes];
485489
}
486490

491+
/**
492+
* Mock Cache class with dummy implementation
493+
*/
487494
private function disableCache()
488495
{
489496
$this->objectManager->configure([
490497
'preferences' => [
491-
\Magento\Framework\App\Cache::class => \Magento\Framework\App\Cache\Type\Dummy::class
498+
Cache::class => DummyCache::class
492499
]
493500
]);
494501
}
495502

503+
/**
504+
* Unmock Cache class
505+
*/
496506
private function enableCache()
497507
{
498508
$this->objectManager->configure([
499509
'preferences' => [
500-
\Magento\Framework\App\Cache::class => \Magento\Framework\App\Cache::class
510+
Cache::class => Cache::class
501511
]
502512
]);
503513
}
Lines changed: 72 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,72 @@
1-
<?php
2-
/**
3-
* Copyright © 2016 Magento. All rights reserved.
4-
* See COPYING.txt for license details.
5-
*/
6-
7-
namespace Magento\Framework\App\Cache\Type;
8-
9-
use \Magento\Framework\App\CacheInterface;
10-
11-
class Dummy implements CacheInterface
12-
{
13-
/**
14-
* Required by CacheInterface
15-
*
16-
* @return Null
17-
*/
18-
public function getFrontend()
19-
{
20-
return null;
21-
}
22-
23-
/**
24-
* Pretend to load data from cache by id
25-
*
26-
* @param string $identifier
27-
* @return null
28-
*/
29-
public function load($identifier)
30-
{
31-
return null;
32-
}
33-
34-
/**
35-
* Pretend to save data
36-
*
37-
* @param string $data
38-
* @param string $identifier
39-
* @param array $tags
40-
* @param int $lifeTime
41-
* @return bool
42-
*/
43-
public function save($data, $identifier, $tags = [], $lifeTime = null)
44-
{
45-
return false;
46-
}
47-
48-
/**
49-
* Pretend to remove cached data by identifier
50-
*
51-
* @param string $identifier
52-
* @return bool
53-
*/
54-
public function remove($identifier)
55-
{
56-
return true;
57-
}
58-
59-
/**
60-
* Pretend to clean cached data by specific tag
61-
*
62-
* @param array $tags
63-
* @return bool
64-
*/
65-
public function clean($tags = [])
66-
{
67-
return true;
68-
}
69-
}
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Framework\App\Cache\Type;
7+
8+
use \Magento\Framework\App\CacheInterface;
9+
10+
class Dummy implements CacheInterface
11+
{
12+
/**
13+
* Required by CacheInterface
14+
*
15+
* @return Null
16+
*/
17+
public function getFrontend()
18+
{
19+
return null;
20+
}
21+
22+
/**
23+
* Pretend to load data from cache by id
24+
*
25+
* @param string $identifier
26+
* @return null
27+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
28+
*/
29+
public function load($identifier)
30+
{
31+
return null;
32+
}
33+
34+
/**
35+
* Pretend to save data
36+
*
37+
* @param string $data
38+
* @param string $identifier
39+
* @param array $tags
40+
* @param int $lifeTime
41+
* @return bool
42+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
43+
*/
44+
public function save($data, $identifier, $tags = [], $lifeTime = null)
45+
{
46+
return false;
47+
}
48+
49+
/**
50+
* Pretend to remove cached data by identifier
51+
*
52+
* @param string $identifier
53+
* @return bool
54+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
55+
*/
56+
public function remove($identifier)
57+
{
58+
return true;
59+
}
60+
61+
/**
62+
* Pretend to clean cached data by specific tag
63+
*
64+
* @param array $tags
65+
* @return bool
66+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
67+
*/
68+
public function clean($tags = [])
69+
{
70+
return true;
71+
}
72+
}

0 commit comments

Comments
 (0)