Import/Export configuration data in Magento 2 via CLI.

Overview

ConfigImportExport

This module provides new CLI commands for Magento 2 to import/export data in/from core_config_data.

This module is inspired by the awesome n98-magerun plugin "HarrisStreet ImpEx" by @SchumacherFM for Magento 1 which you can find here.

Installation

Add the package to your composer.json

composer require semaio/magento2-configimportexport

Enable and install the module

php bin/magento module:enable Semaio_ConfigImportExport
php bin/magento setup:upgrade

Facts

  • Supported Magento versions are 2.3 and 2.4
  • Supported PHP versions are 7.2, 7.3 and 7.4

Functionality

This module is a work in progress and will be extended in the future with more functionality and support for other file formats.

File formats

This module currently supports the following file formats:

  • YAML (default)
  • JSON

See docs/file-formats.md for more information and examples.

Import config data

See docs/config-import.md for more information.

Export config data

See docs/config-export.md for more information.

Support

If you encounter any problems or bugs, please create an issue on GitHub.

Contribution

Any contribution to the development of MageSetup is highly welcome. The best possibility to provide any code is to open a pull request on GitHub.

Licence

Open Software License (OSL 3.0)

Contributors

Thanks to all contributors who invested their valuable time to contribute to this module. Much appreciated!

Copyright

(c) 2016-2020 semaio GmbH / Rouven Alexander Rieker

Comments
  • deal with configuration having more than 3 parts in path

    deal with configuration having more than 3 parts in path

    Please make sure these boxes are checked before submitting your PR - thank you!

    • [x] Pull request is based against develop branch
    • [x] README.md reflects changes (if applicable)
    • [x] New files contain a license header

    Issue

    This PR fixes issue #15 .

    Proposed changes

    Due to the fact that configuration path can have more than 3 parts (separated by /), in the abstract writer we get the first 2 parts normally and use the rest as the third part. E.g:

    Suppose we have this configuration in database:

    system/full_page_cache/varnish/access_list => localhost
    system/full_page_cache/varnish/backend_host => localhost
    system/full_page_cache/varnish/backend_port => 8080
    

    Before the PR, this is the exported yaml configuration

    system:
      full_page_cache:
        varnish:
          default:
            - '8080'
    

    After PR

    system:
      full_page_cache:
        varnish/access_list:
          default:
            - localhost
        varnish/backend_host:
          default:
            - localhost
        varnish/backend_port:
          default:
            - '8080'
    

    There's no change to the reader though as the configuration is parsed correctly either way

    opened by tunght13488 10
  • Thoughts on support for importing secrets via environment variables?

    Thoughts on support for importing secrets via environment variables?

    Has there been any thought or desire to include the ability to import secret config (api user/password, merchant ids, etc) via environment variables? I might pick this up unless there has already been some work done somewhere else, or opinions on how to handle this differently.

    opened by drobinson 9
  • Deprecated Functionality: preg_replace_callback(): Passing null to parameter

    Deprecated Functionality: preg_replace_callback(): Passing null to parameter

    Please make sure that you provide as much information as possible. If you have an example files, which reflect the issue, please make sure to attach them to the issue - thank you!

    General

    • Module version: 3.10.0
    • Magento version: 2.4.5-p1
    • PHP version: 8.1.11

    Issue description

    In ErrorHandler.php line 62:
    
      Deprecated Functionality: preg_replace_callback(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /var/www/html/ve
      ndor/semaio/magento2-configimportexport/Model/Resolver/EnvironmentVariableResolver.php on line 31
    

    Steps to reproduce

    1. run config import with a value (that was exported before) like:
    tax/defaults/postcode:
      default:
        0:
    
    opened by torhoehn 8
  • Magento 2.4.4 and php 8.1 support

    Magento 2.4.4 and php 8.1 support

    Please make sure that you provide as much information as possible. If you have an example files, which reflect the issue, please make sure to attach them to the issue - thank you!

    General

    • Module version: 3.x
    • Magento version: 2.4.4
    • PHP version: 8.1.5

    Issue description

    Any plans to update this module for magento 2.4.4 and php 8.1.x?

    opened by simonmaass 6
  • Commands are not listed by bin/magento for M2.4.1

    Commands are not listed by bin/magento for M2.4.1

    General

    • Module version: 3.3.0
    • Magento version: 2.4.1
    • PHP version: 7.4

    Issue description

    I created a new Magento 2.4.1 project and installed the semaio/magento2-configimportexport package afterward as described in the README file. When invoking bin/magento the commands exposed by the module are not listed and I cannot invoke them.

    I could track things down to this: Currently, the module is registering the commands with type Magento\Framework\Console\CommandList. When changing the type to Magento\Framework\Console\CommandListInterface the commands appear when invoking bin/magento .

    This is also mentioned in the README file of the Console package: https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Console/README.md

    Happy to provide a PR if changing the type makes sense for you.

    opened by shochdoerfer 6
  • Correctly escape single quotes in YAML

    Correctly escape single quotes in YAML

    Issue

    Currently single quotes in config values are escaped using backslashes (i.e., 'testing \' 123'), but this is not valid YAML and causes Symfony to throw an exception when the values are imported back into the database.

    Proposed changes

    Correctly quote single quotes with a repeated single quote (i.e., 'testing '' 123').

    bug 
    opened by scottsb 6
  • Importing fully exported config result in error when run cron

    Importing fully exported config result in error when run cron

    General

    • Module version: 2.0.0
    • Magento version: EE 2.1.5
    • PHP version: 7.0.15

    Issue description

    Magneto use a config with path crontab/default/jobs/magento_scheduled_import_export_log_clean/schedule/cron_expr to store the cron schedule of import/export log cleaning schedule options (See \Magento\ScheduledImportExport\Model\System\Config\Backend\Logclean\Cron::CRON_STRING_PATH). This is exported as crontab/default/jobs. Once the exported file is imported, it will basically discard all crontab configuration (defined in crontab.xml of modules) and result in error when attempt to run cron.

    Steps to reproduce

    1. In Magento backend, Go to Store > Configuration > Advanced > System
    2. Click save
    3. Export config
    4. Import exported files
    5. Try to run cron (bin/magento cron:run)
    6. See error invalid argument supplied to foreach
    opened by tunght13488 6
  • Added support and readme for environment variables

    Added support and readme for environment variables

    Please make sure these boxes are checked before submitting your PR - thank you!

    • [x] Pull request is based against develop branch - no, there is no develop branch
    • [x] README.md reflects changes (if applicable)
    • [x] New files contain a license header

    Issue

    This PR fixes issue #20.

    Proposed changes

    I took the existing PR #21 and processed @ktomk his suggestions, and added a description to the docs.

    opened by peterjaap 5
  • Stabilize parsing of YAML files, fixes #10

    Stabilize parsing of YAML files, fixes #10

    The YAML parser actually returns mixed results but previous non-array cases could not be handled.

    Additionally if a file is being skipped more information is provided.

    opened by tkn98 5
  • allow to import null value

    allow to import null value

    Please make sure these boxes are checked before submitting your PR - thank you!

    • [ ] Pull request is based against develop branch
    • [ ] README.md reflects changes (if applicable)
    • [ ] New files contain a license header

    Issue

    This PR fixes issue #54.

    Proposed changes

    ...

    opened by torhoehn 4
  • YamlReader: get file content before parsing

    YamlReader: get file content before parsing

    With Symfony Yaml >= 3.0 the option to pass a filename was removed. The commit 6c959b8c56a9e027e2f3727cc9719681e1fe2f8e introduces the compatibilty with >=3.0.

    To support 2.0 and 3.0 of Symfony Yaml we need get the file contents in the YamlReader.

    Also see: Yaml.php @ v2.8 https://github.com/symfony/yaml/blob/2.8/Yaml.php#L58 Yaml.php @ v3.3 https://github.com/symfony/yaml/blob/3.3/Yaml.php#L52

    The file_get_contents is no longer there.

    Please make sure these boxes are checked before submitting your PR - thank you!

    • [ ] Pull request is based against develop branch
    • [ ] README.md reflects changes (if applicable)
    • [ ] New files contain a license header

    Issue

    This PR fixes issue # .

    Proposed changes

    ...

    opened by mwr 4
  • Add new --filepath option to allow control over the export path

    Add new --filepath option to allow control over the export path

    • [X] Pull request is based against main branch
    • [X] README.md reflects changes (if applicable)
    • [X] New files contain a license header

    Issue

    This PR fixes issue #60.

    Proposed changes

    Based on the response from @therouv this PR implements a new --filepath option for the export command.

    I believe these changes offer greater flexibility while also improving the default behaviour:

    • --filepath Path into which the export should be written. Defaults to var/semaio/config_export/Ymd_His/.
    • --filename Filename into which the export should be written. Defaults to config.
    opened by bluec 2
  • Greater control of export output directory via --filename parameter

    Greater control of export output directory via --filename parameter

    First of all, thanks for this module; Zookal/HarrisStreet-ImpEx was one of my favourite and most-used M1 magerun tools so it is great to see it recreated and re-imagined for M2.

    One thing I wonder is whether we can have greater control of the export directory using the --filename parameter. Currently it will always export to var/Ymd_His followed by either config or the value of the --filename parameter and then optionally the namespace.

    This isn't very flexible. For example, for my workflow I like to keep a copy of the dumped export in git, but currently it always dumps to a new directory because we can't remove the Ymd_His part of the export path so this then requires a manual step to copy or move everything into a consistent directory.

    Also, a lesser issue than the timestamping is that I might not want the data in var at all but possibly somewhere else. Setting --filename on HarrisStreet-ImpEx provided complete run-time override of the full output directory path.

    I appreciate that emulating the HarrisStreet-ImpEx behaviour and allowing to completely override the path using --filename would be a breaking change for existing workflows so this may not be a popular idea.

    However, a simple solution to the timestamping with no breaking changes would be to add a --timestamp (-t) parameter which defaults to true and if set to false will remove the timestamp portion of the export path. For me personally this would be a huge improvement in usability and come with no cost that I can see.

    What do you think? I could do a PR for the latter if it would be useful?

    opened by bluec 4
Releases(3.10.1)
Owner
semaio
semaio
A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2

Simple Import / Export tool A tool that allows to quickly export data from Magento 1 and Magento 2 store and import it back into Magento 2. Table data

EcomDev B.V. 51 Dec 5, 2022
Magento-bulk - Bulk Import/Export helper scripts and CLI utilities for Magento Commerce

Magento Bulk Bulk operations for Magento. Configuration Copy config.php.sample to config.php and edit it. Product Attribute Management List All Attrib

Bippo Indonesia 23 Dec 20, 2022
Q2A plugin that allows users to import and export Q2A configuration

Configuration Manager [by Gabriel Zanetti] Description Configuration Manager is a Question2Answer plugin that allows users to import and export Q2A co

Gabriel Zanetti 1 Nov 22, 2021
Import data from and export data to a range of different file formats and media

Ddeboer Data Import library This library has been renamed to PortPHP and will be deprecated. Please use PortPHP instead. Introduction This PHP library

David de Boer 570 Dec 27, 2022
YCOM Impersonate. Login as selected YCOM user πŸ§™β€β™‚οΈin frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Friends Of REDAXO 17 Sep 12, 2022
Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel

Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel , mapping of any format, Google Sheet, data and price modification, improved speed and a lot more!

Firebear Studio 173 Dec 17, 2022
Magento 2 - Improved Import / Export extension

Improve default Magento 2 Import / Export features - cron jobs, CSV , XML , JSON , Excel , mapping of any format, Google Sheet, data and price modification, improved speed and a lot more!

Firebear Studio 173 Dec 17, 2022
Gettext is a PHP (^7.2) library to import/export/edit gettext from PO, MO, PHP, JS files, etc.

Gettext Note: this is the documentation of the new 5.x version. Go to 4.x branch if you're looking for the old 4.x version Created by Oscar Otero http

Gettext 651 Dec 29, 2022
Multi-language field export/import tool for ProcessWire

Language field export/import for ProcessWire Typically the way you translate page field values in ProcessWire is to edit a page, view the text in one

Ryan Cramer 3 Aug 19, 2022
Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

Enables developers to modify Magento installations (configuration, data) based on the given environment using n98-magerun.

LimeSoda Interactive Marketing GmbH 73 Apr 1, 2022
Magento n98-magerun module for importing and exporting configuration data

Magento n98-magerun module for importing and exporting configuration data. Import supports hierarchical folder structure and of course different environments.

Zookal 61 Apr 1, 2022
Neo Integrator adalah alat bantu untuk import data ke Neo Feeder dengan cara copy paste saja. bersifat free dan opensource. Semoga Bermanfaat.

Neo-Integrator Penerus dari SimpleFeeder, yang berubah jadi Excel2Feeder dan bertransformasi menjadi Neo-integrator Last Update : 16-05-2022 Capture :

null 9 Nov 26, 2022
This Magento extension provides a Real Full Page Caching for Magento powered by Varnish with support of Session-Based information caching (Cart, Customer Accounts, ...) via ESI includes

This Magento extension provides a Real Full Page Caching (FPC) for Magento powered by Varnish with support of Session-Based information caching (Cart, Customer Accounts, ...) via ESI includes

Hugues Alary 95 Feb 11, 2022
salah eddine bendyab 18 Aug 17, 2021
Faker-driven, configuration-based, platform-agnostic, locale-compatible data faker tool

Masquerade Faker-driven, platform-agnostic, locale-compatible data faker tool Point Masquerade to a database, give it a rule-set defined in YAML and M

elgentos ecommerce solutions 219 Dec 13, 2022
provides a nested object property based user interface for accessing this configuration data within application code

laminas-config This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steeri

Laminas Project 43 Dec 26, 2022
Magento 2 Extension to cleanup admin menu and Store > Configuration area by arranging third party extension items.

Clean Admin Menu - Magento 2 Extension It will merge all 3rd party extension's menu items in backend's primary menu to a common menu item named "Exten

RedChamps 109 Jan 3, 2023