diff --git a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php index 51345c2b7609cb8e39cf25fb9a4f4f202cba6f65..8a006c8154b4b97eb6d39c1d41f8363b3e4df761 100644 --- a/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php +++ b/app/code/Magento/Deploy/Console/Command/DeployStaticContentCommand.php @@ -3,7 +3,6 @@ * Copyright © 2016 Magento. All rights reserved. * See COPYING.txt for license details. */ - namespace Magento\Deploy\Console\Command; use Magento\Framework\App\Utility\Files; @@ -19,6 +18,8 @@ use Magento\Framework\Exception\LocalizedException; use Magento\Framework\App\State; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Deploy\Model\DeployManager; +use Magento\Framework\App\Cache; +use Magento\Framework\App\Cache\Type\Dummy as DummyCache; /** * Deploy static content command @@ -29,7 +30,7 @@ class DeployStaticContentCommand extends Command /** * Key for dry-run option * @deprecated - * @see Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN + * @see \Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN */ const DRY_RUN_OPTION = 'dry-run'; @@ -87,6 +88,7 @@ class DeployStaticContentCommand extends Command * @param ObjectManagerFactory $objectManagerFactory * @param Locale $validator * @param ObjectManagerInterface $objectManager + * @throws \LogicException When the command name is empty */ public function __construct( ObjectManagerFactory $objectManagerFactory, @@ -96,6 +98,7 @@ class DeployStaticContentCommand extends Command $this->objectManagerFactory = $objectManagerFactory; $this->validator = $validator; $this->objectManager = $objectManager; + parent::__construct(); } @@ -373,6 +376,7 @@ class DeployStaticContentCommand extends Command /** * {@inheritdoc} * @throws \InvalidArgumentException + * @throws LocalizedException */ protected function execute(InputInterface $input, OutputInterface $output) { @@ -394,9 +398,9 @@ class DeployStaticContentCommand extends Command list ($deployableLanguages, $deployableAreaThemeMap, $requestedThemes) = $this->prepareDeployableEntities($filesUtil); - $output->writeln("Requested languages: " . implode(', ', $deployableLanguages)); - $output->writeln("Requested areas: " . implode(', ', array_keys($deployableAreaThemeMap))); - $output->writeln("Requested themes: " . implode(', ', $requestedThemes)); + $output->writeln('Requested languages: ' . implode(', ', $deployableLanguages)); + $output->writeln('Requested areas: ' . implode(', ', array_keys($deployableAreaThemeMap))); + $output->writeln('Requested themes: ' . implode(', ', $requestedThemes)); /** @var $deployManager DeployManager */ $deployManager = $this->objectManager->create( @@ -415,11 +419,13 @@ class DeployStaticContentCommand extends Command } } + $this->mockCache(); return $deployManager->deploy(); } /** * @param Files $filesUtil + * @throws \InvalidArgumentException * @return array * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) @@ -476,4 +482,18 @@ class DeployStaticContentCommand extends Command return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes]; } + + /** + * Mock Cache class with dummy implementation + * + * @return void + */ + private function mockCache() + { + $this->objectManager->configure([ + 'preferences' => [ + Cache::class => DummyCache::class + ] + ]); + } } diff --git a/lib/internal/Magento/Framework/App/Cache/Type/Dummy.php b/lib/internal/Magento/Framework/App/Cache/Type/Dummy.php new file mode 100644 index 0000000000000000000000000000000000000000..ea6a3c3e92e7e615740990170d218608aff99836 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Cache/Type/Dummy.php @@ -0,0 +1,67 @@ +<?php +/** + * Copyright © 2016 Magento. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\App\Cache\Type; + +use Magento\Framework\App\CacheInterface; + +/** + * Dummy cache adapter + * + * for cases when need to disable interaction with cache + * but no specific cache type is used + */ +class Dummy implements CacheInterface +{ + /** + * Required by CacheInterface + * + * @return null + */ + public function getFrontend() + { + return null; + } + + /** + * Pretend to load data from cache by id + * + * {@inheritdoc} + */ + public function load($identifier) + { + return null; + } + + /** + * Pretend to save data + * + * {@inheritdoc} + */ + public function save($data, $identifier, $tags = [], $lifeTime = null) + { + return false; + } + + /** + * Pretend to remove cached data by identifier + * + * {@inheritdoc} + */ + public function remove($identifier) + { + return true; + } + + /** + * Pretend to clean cached data by specific tag + * + * {@inheritdoc} + */ + public function clean($tags = []) + { + return true; + } +}