-
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 #1087 from magento-falcons/MAGETWO-68764
[Falcons]: Delivery of Bugfixes for Deployment
- Loading branch information
Showing
10 changed files
with
336 additions
and
205 deletions.
There are no files selected for viewing
95 changes: 0 additions & 95 deletions
95
app/code/Magento/Config/Console/Command/ConfigSet/EmulatedProcessorFacade.php
This file was deleted.
Oops, something went wrong.
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
67 changes: 67 additions & 0 deletions
67
app/code/Magento/Config/Console/Command/EmulatedAdminhtmlAreaProcessor.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,67 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\Config\Console\Command; | ||
|
||
use Magento\Framework\App\Area; | ||
use Magento\Framework\App\State; | ||
use Magento\Framework\Config\ScopeInterface; | ||
|
||
/** | ||
* Emulates callback inside adminhtml area code and adminhtml scope. | ||
* It is used for CLI commands which should work with data available only in adminhtml scope. | ||
*/ | ||
class EmulatedAdminhtmlAreaProcessor | ||
{ | ||
/** | ||
* 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 | ||
*/ | ||
public function __construct(ScopeInterface $scope, State $state) | ||
{ | ||
$this->scope = $scope; | ||
$this->state = $state; | ||
} | ||
|
||
/** | ||
* Emulates callback inside adminhtml area code and adminhtml scope. | ||
* | ||
* Returns the return value of the callback. | ||
* | ||
* @param callable $callback The callable to be called | ||
* @param array $params The parameters to be passed to the callback, as an indexed array | ||
* @return bool|int|float|string|array|null - as the result of this method is the result of callback, | ||
* you can use callback only with specified in this method return types | ||
* @throws \Exception The exception is thrown if the parameter $callback throws an exception | ||
*/ | ||
public function process(callable $callback, array $params = []) | ||
{ | ||
$currentScope = $this->scope->getCurrentScope(); | ||
try { | ||
return $this->state->emulateAreaCode(Area::AREA_ADMINHTML, function () use ($callback, $params) { | ||
$this->scope->setCurrentScope(Area::AREA_ADMINHTML); | ||
return call_user_func_array($callback, $params); | ||
}); | ||
} catch (\Exception $exception) { | ||
throw $exception; | ||
} finally { | ||
$this->scope->setCurrentScope($currentScope); | ||
} | ||
} | ||
} |
74 changes: 0 additions & 74 deletions
74
app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/EmulatedProcessorFacadeTest.php
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.