Problem/Motivation

When the drupal site it setup with a base_url that is inside a subdirectory of the domain, a CM Document export will put the subdirectory in the file name. However the import command will not be looking for the subdirectory name, so it fails to find the file to import.

Steps to reproduce

Site with base url = https://example.com/mydrupal/
Export a CM Document
Notice the file name is `mydrupalzZzALIASzZzOFzZzPAGE.yml`
But when you import the page if you use:

  • drush content-model-documentation:import /mydrupal/ALIAS/OF/PAGE the import will create a new document because there are not aliases in Drupal that begin with `mydrupal` (the site's sub-directory)
  • drush content-model-documentation:import /ALIAS/OF/PAGE the import will not work at all because it can't find an import file by that name.

Temp Workaround

Edit the export filenames to remove the subdirectory and the first zZz (which is the equivalent of a / )

Proposed resolution

There are two choices here (I am not sure which is best yet, but I am leaning toward #2.)

  1. Detect the subdirectory and remove if from the export file name before export. - This would force the import runner to use the path not including the subdirectory in the import command, which may be a little confusing.
  2. Detect the subdirectory just before looking up the alias and remove it. - This would allow the full path of the destination CM Document to be used in the import command.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

swirt created an issue. See original summary.

swirt credited majorrobot.

swirt’s picture

Crediting majorrobot for surfacing this bug and helping determine what the problem is.

swirt’s picture

Title: When a site live in a sub-directory CM Document export misnames the file » When a site lives in a sub-directory CM Document export misnames the file

majorrobot’s picture

Status: Active » Reviewed & tested by the community

I've tested the MR on my local (which has Drupal in a subdirectory) and can confirm I can export and import correctly. Thank you, @swirt!

  • swirt committed 7f00e1d0 on 1.0.x
    Issue #3428591 by majorrobot: When a site lives in a sub-directory CM...
swirt’s picture

Status: Reviewed & tested by the community » Fixed

Thank you @majorrobot. This has been merged and will be released shortly in 1.0.28

swirt’s picture

Status: Fixed » Closed (fixed)

Released as part of 1.0.28

swirt’s picture

I decided in this approach to do both 1 and 2. So the subdirectory(s) will not appear in the export file name, AND when you do the import, whether or not you use the subdirectory(s) in the import path (alias) will make no difference. The import will take place correctly.