Skip to content

Commit e9e137b

Browse files
committed
MAGETWO-58594: Merge branch 'perf-magetwo-58594' of github.com:magento-performance/magento2ce into pr-develop
2 parents 7ef0730 + 8a41008 commit e9e137b

File tree

2 files changed

+92
-5
lines changed

2 files changed

+92
-5
lines changed

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

Lines changed: 25 additions & 5 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,
@@ -96,6 +98,7 @@ public function __construct(
9698
$this->objectManagerFactory = $objectManagerFactory;
9799
$this->validator = $validator;
98100
$this->objectManager = $objectManager;
101+
99102
parent::__construct();
100103
}
101104

@@ -373,6 +376,7 @@ private function getDeployableEntities($entities, $includedEntities, $excludedEn
373376
/**
374377
* {@inheritdoc}
375378
* @throws \InvalidArgumentException
379+
* @throws LocalizedException
376380
*/
377381
protected function execute(InputInterface $input, OutputInterface $output)
378382
{
@@ -394,9 +398,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
394398
list ($deployableLanguages, $deployableAreaThemeMap, $requestedThemes)
395399
= $this->prepareDeployableEntities($filesUtil);
396400

397-
$output->writeln("Requested languages: " . implode(', ', $deployableLanguages));
398-
$output->writeln("Requested areas: " . implode(', ', array_keys($deployableAreaThemeMap)));
399-
$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));
400404

401405
/** @var $deployManager DeployManager */
402406
$deployManager = $this->objectManager->create(
@@ -415,11 +419,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
415419
}
416420
}
417421

422+
$this->mockCache();
418423
return $deployManager->deploy();
419424
}
420425

421426
/**
422427
* @param Files $filesUtil
428+
* @throws \InvalidArgumentException
423429
* @return array
424430
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
425431
* @SuppressWarnings(PHPMD.NPathComplexity)
@@ -476,4 +482,18 @@ private function prepareDeployableEntities($filesUtil)
476482

477483
return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes];
478484
}
485+
486+
/**
487+
* Mock Cache class with dummy implementation
488+
*
489+
* @return void
490+
*/
491+
private function mockCache()
492+
{
493+
$this->objectManager->configure([
494+
'preferences' => [
495+
Cache::class => DummyCache::class
496+
]
497+
]);
498+
}
479499
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
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+
/**
11+
* Dummy cache adapter
12+
*
13+
* for cases when need to disable interaction with cache
14+
* but no specific cache type is used
15+
*/
16+
class Dummy implements CacheInterface
17+
{
18+
/**
19+
* Required by CacheInterface
20+
*
21+
* @return null
22+
*/
23+
public function getFrontend()
24+
{
25+
return null;
26+
}
27+
28+
/**
29+
* Pretend to load data from cache by id
30+
*
31+
* {@inheritdoc}
32+
*/
33+
public function load($identifier)
34+
{
35+
return null;
36+
}
37+
38+
/**
39+
* Pretend to save data
40+
*
41+
* {@inheritdoc}
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+
* {@inheritdoc}
52+
*/
53+
public function remove($identifier)
54+
{
55+
return true;
56+
}
57+
58+
/**
59+
* Pretend to clean cached data by specific tag
60+
*
61+
* {@inheritdoc}
62+
*/
63+
public function clean($tags = [])
64+
{
65+
return true;
66+
}
67+
}

0 commit comments

Comments
 (0)