Skip to content

Fix notices and failure of deploy static content #7059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Magento\Deploy\Model\DeployManager;
use Magento\Framework\App\Cache;
use Magento\Framework\App\Cache\Type\Dummy as DummyCache;
use Magento\Framework\ObjectManager\ConfigInterface;

/**
* Deploy static content command
Expand Down Expand Up @@ -82,22 +83,30 @@ class DeployStaticContentCommand extends Command
/** @var \Magento\Framework\App\State */
private $appState;

/**
* @var \Magento\Framework\ObjectManager\ConfigInterface $config
*/
protected $config;

/**
* Inject dependencies
*
* @param ObjectManagerFactory $objectManagerFactory
* @param Locale $validator
* @param ObjectManagerInterface $objectManager
* @param ConfigInterface $config
* @throws \LogicException When the command name is empty
*/
public function __construct(
ObjectManagerFactory $objectManagerFactory,
Locale $validator,
ObjectManagerInterface $objectManager
ObjectManagerInterface $objectManager,
ConfigInterface $config
) {
$this->objectManagerFactory = $objectManagerFactory;
$this->validator = $validator;
$this->objectManager = $objectManager;
$this->config = $config;

parent::__construct();
}
Expand Down Expand Up @@ -490,10 +499,17 @@ private function prepareDeployableEntities($filesUtil)
*/
private function mockCache()
{
$preferences = $this->config->getPreferences();
$instanceTypes = $this->config->getVirtualTypes();
$arguments = $this->config->getAllArguments();

//Swap out the cache class and maintain current preferences/instance types/arguments
$preferences[Cache::class] = DummyCache::class;

$this->objectManager->configure([
'preferences' => [
Cache::class => DummyCache::class
]
'preferences' => $preferences,
'arguments' => $arguments,
'instanceTypes' => $instanceTypes
]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ interface DeployStaticOptionsInterface
const EXCLUDE_AREA = 'exclude-area';

/**
* Jey for jobs option
* Key for jobs option
*/
const JOBS_AMOUNT = 'jobs';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,16 @@ public function getVirtualTypes()
return [];
}

/**
* Returns entire arguments keyed by type
*
* @return array
*/
public function getAllArguments()
{
return [];
}

/**
* Extend configuration
*
Expand Down
10 changes: 10 additions & 0 deletions lib/internal/Magento/Framework/ObjectManager/Config/Compiled.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,14 @@ public function getPreferences()
{
return $this->preferences;
}

/**
* Returns list on preferences
*
* @return array
*/
public function getAllArguments()
{
return $this->arguments;
}
}
10 changes: 10 additions & 0 deletions lib/internal/Magento/Framework/ObjectManager/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,14 @@ public function getPreferences()
{
return $this->_preferences;
}

/**
* Returns list on preferences
*
* @return array
*/
public function getAllArguments()
{
return $this->_arguments;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public function setCache(ConfigCacheInterface $cache);
*/
public function getArguments($type);

/**
* Returns entire arguments keyed by type
*
* @return array
*/
public function getAllArguments();

/**
* Check whether type is shared
*
Expand Down