Drush command for Export / Import

Created on 22 November 2022, almost 2 years ago
Updated 14 July 2024, 4 months ago

Problem/Motivation

When doing automated deployments of a site using this menu_export, it is very annoying to manually need to trigger the import of the menu items from the configuration in the backend. This leads to potential for human error and should be able to be automated.

Proposed resolution

Add a drush command for the export / import triggers, so this command can be included into the CI pipelines for automated import of the menu items.

Remaining tasks

Build drush command.

User interface changes

None

API changes

None

Data model changes

None

✨ Feature request
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany fisherman90 Dortmund

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΉπŸ‡·Turkey alexander.levitsky Antalya

    alexander.levitsky β†’ made their first commit to this issue’s fork.

  • @alexanderlevitsky opened merge request.
  • πŸ‡ΉπŸ‡·Turkey alexander.levitsky Antalya

    Hi fisherman90,

    Really thank you for your solution, but let's keep the only drush command in the scope of this issue, without any code style fixes, because it conflicts with other patches.

    I have prepared another PR with your drush command only.

    Btw, it works perfectly for me as well.

  • πŸ‡¨πŸ‡¦Canada liquidcms

    I guess since i dont see UUIDs in the export yml this cant be used to sync existing menus, only to create new ones?

    also, a bit unclear the what this adds with these new commands. The README already stated that the std CEX/CIM works for this. I think CEX sort of works and CIM doesn't.

    I tried the menu_export:import and i get:

    SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '231' for key 'menu_link_content__revisio
    n_id'

    i assume as my menu already exists and i am just trying to update it.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    I can't see why a Drush export command is needed? I just installed the module, added a menu, ran drush config:export, and the menu was exported in a yml file, as expected. I did not need to click the "export" button.

    So I just posted this comment πŸ“Œ Step by Step Instructions Here (I Think) Active , assuming that since drush config:export includes the yml-files without any further steps, I assumed that "drush config:import" would import the menu links ...

    So do you need to manually click "import", but don't need to manually click "export"?

  • Status changed to Needs work about 1 year ago
  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    It does look like the menus are not imported, and you actively need to click the "Import menu links" button. The patch needs a re-roll, so changing Status.

  • First commit to issue fork.
  • Merge request !15Resolve #3323102 "Drush command 1.x" β†’ (Open) created by mortona2k
  • Status changed to Needs review 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States mortona2k Seattle

    I rebased the branch on 1.x.

    Had to change the services file to drush.services.yml to get it to recognize the command.

    To fix the errors in #10, apply the patch from here: https://www.drupal.org/project/menu_export/issues/3399829#comment-15484598 πŸ› Menu Import broken in Drupal 10 Needs review

Production build 0.71.5 2024