-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1004 from magento-falcons/MAGETWO-67152
[Falcons] Delivery of deployment improvements #2
- Loading branch information
Showing
41 changed files
with
1,134 additions
and
604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/code/Magento/Config/App/Config/Source/InitialSnapshotConfigSource.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Config\App\Config\Source; | ||
|
||
use Magento\Framework\App\Config\ConfigSourceInterface; | ||
use Magento\Framework\DataObjectFactory; | ||
use Magento\Framework\FlagManager; | ||
|
||
/** | ||
* The source with previously imported configuration. | ||
*/ | ||
class InitialSnapshotConfigSource implements ConfigSourceInterface | ||
{ | ||
/** | ||
* The factory of Flag instances. | ||
* | ||
* @var FlagManager | ||
*/ | ||
private $flagManager; | ||
|
||
/** | ||
* The factory of DataObject instances. | ||
* | ||
* @var DataObjectFactory | ||
*/ | ||
private $dataObjectFactory; | ||
|
||
/** | ||
* @param FlagManager $flagManager The factory of Flag instances | ||
* @param DataObjectFactory $dataObjectFactory The factory of DataObject instances | ||
*/ | ||
public function __construct(FlagManager $flagManager, DataObjectFactory $dataObjectFactory) | ||
{ | ||
$this->flagManager = $flagManager; | ||
$this->dataObjectFactory = $dataObjectFactory; | ||
} | ||
|
||
/** | ||
* Retrieves previously imported configuration. | ||
* Snapshots are stored in flags. | ||
* | ||
* {@inheritdoc} | ||
*/ | ||
public function get($path = '') | ||
{ | ||
$flagData = (array)($this->flagManager->getFlagData('system_config_snapshot') ?: []); | ||
|
||
$data = $this->dataObjectFactory->create( | ||
['data' => $flagData] | ||
); | ||
|
||
return $data->getData($path) ?: []; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
app/code/Magento/Config/Console/Command/ConfigSet/EmulatedProcessorFacade.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Config\Console\Command\ConfigSet; | ||
|
||
use Magento\Framework\App\Area; | ||
use Magento\Framework\App\State; | ||
use Magento\Framework\Config\ScopeInterface; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\Framework\Exception\RuntimeException; | ||
|
||
/** | ||
* Processor facade for config:set command with emulated adminhtml area. | ||
*/ | ||
class EmulatedProcessorFacade | ||
{ | ||
/** | ||
* The factory for processor facade. | ||
* | ||
* @var ProcessorFacadeFactory | ||
*/ | ||
private $processorFacadeFactory; | ||
|
||
/** | ||
* The application scope manager. | ||
* | ||
* @var ScopeInterface | ||
*/ | ||
private $scope; | ||
|
||
/** | ||
* The application state manager. | ||
* | ||
* @var State | ||
*/ | ||
private $state; | ||
|
||
/** | ||
* @param ScopeInterface $scope The application scope manager | ||
* @param State $state The application state manager | ||
* @param ProcessorFacadeFactory $processorFacadeFactory The factory for processor facade | ||
*/ | ||
public function __construct( | ||
ScopeInterface $scope, | ||
State $state, | ||
ProcessorFacadeFactory $processorFacadeFactory | ||
) { | ||
$this->scope = $scope; | ||
$this->state = $state; | ||
$this->processorFacadeFactory = $processorFacadeFactory; | ||
} | ||
|
||
/** | ||
* Processes config:set command. | ||
* | ||
* @param string $path The configuration path in format group/section/field_name | ||
* @param string $value The configuration value | ||
* @param string $scope The configuration scope (default, website, or store) | ||
* @param string $scopeCode The scope code | ||
* @param boolean $lock The lock flag | ||
* @return string Processor response message | ||
* @throws RuntimeException If exception was catch | ||
*/ | ||
public function process($path, $value, $scope, $scopeCode, $lock) | ||
{ | ||
$currentScope = $this->scope->getCurrentScope(); | ||
|
||
try { | ||
// Emulating adminhtml scope to be able to read configs. | ||
return $this->state->emulateAreaCode(Area::AREA_ADMINHTML, function () use ( | ||
$path, | ||
$value, | ||
$scope, | ||
$scopeCode, | ||
$lock | ||
) { | ||
$this->scope->setCurrentScope(Area::AREA_ADMINHTML); | ||
|
||
return $this->processorFacadeFactory->create()->process( | ||
$path, | ||
$value, | ||
$scope, | ||
$scopeCode, | ||
$lock | ||
); | ||
}); | ||
} catch (LocalizedException $exception) { | ||
throw new RuntimeException(__('%1', $exception->getMessage()), $exception); | ||
} finally { | ||
$this->scope->setCurrentScope($currentScope); | ||
} | ||
} | ||
} |
Oops, something went wrong.