Score:-3

How does `drush cim` find and handle the config-directory?

cn flag

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.

cn flag
Current drush is 11, not 9, and the docs are here: https://www.drush.org/latest/commands/config_import/.
Top-Master avatar
cn flag
@PatrickKenny sorry, I have 9 installed.
cn flag
Please ask one question per post. Thanks!
Top-Master avatar
cn flag
@Clive one for all, how does `drush cim` work, but guess need to ask new question?
Score:-1
cn flag

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.

ru flag
`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`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.