-3

I would like to know where the config directory is, and how drush cim command exactly handles it, to be more specific:

  • Where are the setting files imported from, can you provide me with a path relative to the root (I mean, relative to where the main index.php file of drupal is)?

  • Can we change the import path?

  • Does cim command remove the files after they are imported, or not?

  • Can we tell drush to just delete any (previously exported) setting files?

Note that I already did read https://www.drush.org/latest/commands/config_import/
and https://www.drush.org/latest/commands/config_import/

But at the time of writting (namely 2022),
that of version 9x just lists some command-line options, not even what they do.
And docs of version 11 (current latest) do not clarify above points either.

0

1 Answer 1

0

Where are the setting files imported from, can you provide me with a path relative to the root (I mean, relative to where the main index.php file of Drupal is)?

By default they are imported from a directory and/or path with following schema:

sites/default/files/config_RANDOM-HASH/sync

I mean, the RANDOM-HASH part of above is replaced, and can be anything.

The configuration folder's path can be set in "sites/default/settings.php" file (without quotes, and relative to your index.php), but in multi-site environments, you may need to change "default" to something else.

Said file may import other files, which set the path, instead of setting the path directly in settings.php.

However, setting the path should look like:

$config_directories = array();
$config_directories['sync'] = '../d8_config/sync';

Which is again relative to index.php file (from Drupal's root, goes one folder up, for security-reasons).

Can we change the import path?

Yes, change the path in the above said settings.php file.

Does cim command remove the files after they are imported?

No.

Can we tell drush to just delete any (previously exported) setting files?

Each time we export configurations, the old configuration files will be all deleted, and new files get created based on database (where the old files were).

Note that drush cdel takes configuration object as input argument, and deletes it (from the active configuration) in the database, not the exported .yml files.

1
  • d8_config/sync is not the default config export/import directory, by default it is a random directory following the scheme sites/default/files/config_RANDOM-HASH/sync
    – Hudri
    Feb 25, 2022 at 10:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.