-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MAGECLOUD-1424: Re-factor automatic module enabling (#120)
* MAGECLOUD-1424: Fixes issue with new modules not being enabled during di:compile by doing this: saves copy of config.php, enables all modules, then merges old copy back into config.php
- Loading branch information
1 parent
9d0bcf1
commit cea8956
Showing
11 changed files
with
306 additions
and
312 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\MagentoCloud\Config\Shared; | ||
|
||
use Magento\MagentoCloud\Filesystem\Driver\File; | ||
use Magento\MagentoCloud\Filesystem\FileList; | ||
use Magento\MagentoCloud\Filesystem\Writer\WriterInterface; | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
class Writer implements WriterInterface | ||
{ | ||
/** | ||
* @var Reader | ||
*/ | ||
private $reader; | ||
|
||
/** | ||
* @var File | ||
*/ | ||
private $file; | ||
|
||
/** | ||
* @var FileList | ||
*/ | ||
private $fileList; | ||
|
||
/** | ||
* @param Reader $reader , | ||
* @param File $file | ||
* @param FileList $fileList | ||
*/ | ||
public function __construct( | ||
Reader $reader, | ||
File $file, | ||
FileList $fileList | ||
) { | ||
$this->reader = $reader; | ||
$this->file = $file; | ||
$this->fileList = $fileList; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function create(array $config) | ||
{ | ||
$updatedConfig = '<?php' . PHP_EOL . 'return ' . var_export($config, true) . ';'; | ||
|
||
$this->file->filePutContents($this->fileList->getConfig(), $updatedConfig); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function update(array $config) | ||
{ | ||
$this->create( | ||
array_replace_recursive($this->reader->read(), $config) | ||
); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\MagentoCloud\Filesystem\Writer; | ||
|
||
/** | ||
* Write content of file. | ||
*/ | ||
interface WriterInterface | ||
{ | ||
/** | ||
* Writes given configuration to file. | ||
* | ||
* @param array $config | ||
* @return void | ||
*/ | ||
public function create(array $config); | ||
|
||
/** | ||
* Updates existence configuration. | ||
* | ||
* @param array $config | ||
* @return void | ||
*/ | ||
public function update(array $config); | ||
} |
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
Oops, something went wrong.