Skip to content
Snippets Groups Projects
Commit e9e137bd authored by Andrii Dimov's avatar Andrii Dimov
Browse files

MAGETWO-58594: Merge branch 'perf-magetwo-58594' of...

MAGETWO-58594: Merge branch 'perf-magetwo-58594' of github.com:magento-performance/magento2ce into pr-develop
parents 7ef07303 8a41008a
Branches
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
* Copyright © 2016 Magento. All rights reserved. * Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details. * See COPYING.txt for license details.
*/ */
namespace Magento\Deploy\Console\Command; namespace Magento\Deploy\Console\Command;
use Magento\Framework\App\Utility\Files; use Magento\Framework\App\Utility\Files;
...@@ -19,6 +18,8 @@ use Magento\Framework\Exception\LocalizedException; ...@@ -19,6 +18,8 @@ use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\App\State; use Magento\Framework\App\State;
use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options; use Magento\Deploy\Console\Command\DeployStaticOptionsInterface as Options;
use Magento\Deploy\Model\DeployManager; use Magento\Deploy\Model\DeployManager;
use Magento\Framework\App\Cache;
use Magento\Framework\App\Cache\Type\Dummy as DummyCache;
/** /**
* Deploy static content command * Deploy static content command
...@@ -29,7 +30,7 @@ class DeployStaticContentCommand extends Command ...@@ -29,7 +30,7 @@ class DeployStaticContentCommand extends Command
/** /**
* Key for dry-run option * Key for dry-run option
* @deprecated * @deprecated
* @see Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN * @see \Magento\Deploy\Console\Command\DeployStaticOptionsInterface::DRY_RUN
*/ */
const DRY_RUN_OPTION = 'dry-run'; const DRY_RUN_OPTION = 'dry-run';
...@@ -87,6 +88,7 @@ class DeployStaticContentCommand extends Command ...@@ -87,6 +88,7 @@ class DeployStaticContentCommand extends Command
* @param ObjectManagerFactory $objectManagerFactory * @param ObjectManagerFactory $objectManagerFactory
* @param Locale $validator * @param Locale $validator
* @param ObjectManagerInterface $objectManager * @param ObjectManagerInterface $objectManager
* @throws \LogicException When the command name is empty
*/ */
public function __construct( public function __construct(
ObjectManagerFactory $objectManagerFactory, ObjectManagerFactory $objectManagerFactory,
...@@ -96,6 +98,7 @@ class DeployStaticContentCommand extends Command ...@@ -96,6 +98,7 @@ class DeployStaticContentCommand extends Command
$this->objectManagerFactory = $objectManagerFactory; $this->objectManagerFactory = $objectManagerFactory;
$this->validator = $validator; $this->validator = $validator;
$this->objectManager = $objectManager; $this->objectManager = $objectManager;
parent::__construct(); parent::__construct();
} }
...@@ -373,6 +376,7 @@ class DeployStaticContentCommand extends Command ...@@ -373,6 +376,7 @@ class DeployStaticContentCommand extends Command
/** /**
* {@inheritdoc} * {@inheritdoc}
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
* @throws LocalizedException
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
...@@ -394,9 +398,9 @@ class DeployStaticContentCommand extends Command ...@@ -394,9 +398,9 @@ class DeployStaticContentCommand extends Command
list ($deployableLanguages, $deployableAreaThemeMap, $requestedThemes) list ($deployableLanguages, $deployableAreaThemeMap, $requestedThemes)
= $this->prepareDeployableEntities($filesUtil); = $this->prepareDeployableEntities($filesUtil);
$output->writeln("Requested languages: " . implode(', ', $deployableLanguages)); $output->writeln('Requested languages: ' . implode(', ', $deployableLanguages));
$output->writeln("Requested areas: " . implode(', ', array_keys($deployableAreaThemeMap))); $output->writeln('Requested areas: ' . implode(', ', array_keys($deployableAreaThemeMap)));
$output->writeln("Requested themes: " . implode(', ', $requestedThemes)); $output->writeln('Requested themes: ' . implode(', ', $requestedThemes));
/** @var $deployManager DeployManager */ /** @var $deployManager DeployManager */
$deployManager = $this->objectManager->create( $deployManager = $this->objectManager->create(
...@@ -415,11 +419,13 @@ class DeployStaticContentCommand extends Command ...@@ -415,11 +419,13 @@ class DeployStaticContentCommand extends Command
} }
} }
$this->mockCache();
return $deployManager->deploy(); return $deployManager->deploy();
} }
/** /**
* @param Files $filesUtil * @param Files $filesUtil
* @throws \InvalidArgumentException
* @return array * @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.NPathComplexity)
...@@ -476,4 +482,18 @@ class DeployStaticContentCommand extends Command ...@@ -476,4 +482,18 @@ class DeployStaticContentCommand extends Command
return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes]; return [$deployableLanguages, $deployableAreaThemeMap, $requestedThemes];
} }
/**
* Mock Cache class with dummy implementation
*
* @return void
*/
private function mockCache()
{
$this->objectManager->configure([
'preferences' => [
Cache::class => DummyCache::class
]
]);
}
} }
<?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;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment