Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $skip = [
- 'customer/address_templates/html',
- // add any config paths you might want to avoid importing
- ];
- $config = include './config_backup.php'; // this is the dumped config backup
- $i = 0;
- echo "<pre>";
- foreach ($config['system'] as $l0 => $l0items) {
- if ($l0 == 'default') {
- foreach ($l0items as $l1 => $l1items) {
- foreach ($l1items as $l2 => $l2items) {
- if (!is_array($l2items)) { continue; }
- foreach ($l2items as $key => $value) {
- if (in_array("$l1/$l2/$key", $skip)) {
- continue;
- }
- $buffer = "bin/magento config:set $l1/$l2/$key";
- if (is_string($value)) {
- $buffer .= ' "' . str_replace('"', '\"', $value) . '";';
- echo '<br />echo "#'.$i++.' - Setting : ' . $l1.'/'.$l2.'/'.$key.'";<br />';
- echo $buffer;
- } else {
- continue;
- }
- }
- }
- }
- } else {
- foreach ($l0items as $scope => $items) {
- if (in_array($scope, ['admin', 'default'])) {
- continue;
- }
- foreach ($items as $l1 => $l1items) {
- foreach ($l1items as $l2 => $l2items) {
- if (!is_array($l2items)) { continue; }
- foreach ($l2items as $key => $value) {
- if (in_array("$l1/$l2/$key", $skip)) {
- continue;
- }
- $buffer = "bin/magento config:set $l1/$l2/$key --scope website --scope-code $scope";
- if (is_string($value)) {
- $buffer .= ' "' . str_replace('"', '\"', $value) . '";';
- echo '<br />echo "#'.$i++.' - Setting : ' . $l1.'/'.$l2.'/'.$key.' for website ' . $scope .'";<br />';
- echo $buffer;
- } else {
- continue;
- }
- }
- }
- }
- }
- }
- }
- echo "</pre>";
- ?>
- <style>
- pre {
- background : #ddd;
- padding : 20px 40px;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement