4

The Drupal 8 documentation seems to be lacking in regards to the core.extension.yml file, so I'm a little confused on the right way of updating it.

  1. Should drush be populating it on config export, or are you supposed to manually update it?

  2. Do I need to move it from core to my config/sync folder, or leave it in core?

My file's contents are this, even though I have a handful of modules enabled on the site and have exported my config numerous times:

module: {}
theme: {}
profile: ''

On the site I am exporting from (site a) I am using composer to download modules and drush en to enable them, then drush cex to export the configuration to my sync folder. When I copy the sync folder contents over site b and import via drush cim I run into errors that the modules are not installed / enabled. Manually enabling each module then re-importing was successful.

Both sites are 8.3.7.

1
  • 1
    I'm going to mark Adrian's answer below as correct with the following clarification in case it helps anyone else who finds this. I didn't realize that the drush export created a copy of core.extension.yml inside the sync folder. This keeps everything separate from the copy in Drupal core and allows it to be bundled and moved with the other exported yml files. I also realized that I was forgetting to run composer update on site b to download and install the modules. They didn't exist, so the import couldn't enable them. Running composer first before the import made everything work. Commented Sep 27, 2017 at 6:06

2 Answers 2

2

I think that the problem comes from where you have the config files, to be sure that they are really in the config/sync folder go to check if you have this following line in the settings.php file:

$config_directories = array(CONFIG_SYNC_DIRECTORY => 'config/sync');

Keep in mind that this line will have the location of the site configuration files.

Each time you use the drush cex or drush cex sync command the core.extension.yml file will be updated (if needed) with the actual modules (and others) configuration.

3
  • at project-root/web/sites/default/settings.php I have the following: $config_directories['sync'] = '../config/sync'; I am basing my install off of github.com/drupal-composer/drupal-project so my /web folder is my docroot. Commented Sep 21, 2017 at 19:08
  • @tomster2300 use $config_directories = array(CONFIG_SYNC_DIRECTORY => 'config/sync'); and your sync directory will be inside the drupal directory where usually is placed. Commented Sep 21, 2017 at 19:12
  • 1
    @tomster2300 I don't know maybe you want to use the ../config/sync location Commented Sep 21, 2017 at 19:12
1

core.extension.yml is a YAML file listing all installed and enabled modules, themes, and profiles and their respective weight (if specified).

The correct way of declaring the sync directory in settings.php changed with Drupal 8.8.0 as follows:

Before:

$config_directories['sync'] = 'sites/default/files/config_YLZJmmpOqc_KBWbMc2I58ky3-8c7qtg4G-OpSqFClHs5E0NL9YMFgyF4RRTv8IFdl_kAMs_Bdw/sync';

After:

$settings['config_sync_directory'] = 'sites/default/files/config_YLZJmmpOqc_KBWbMc2I58ky3-8c7qtg4G-OpSqFClHs5E0NL9YMFgyF4RRTv8IFdl_kAMs_Bdw/sync';

See: https://www.drupal.org/node/3018145


In terms of location, it's generally considered to be more secure if it's below the webroot, e.g.:

$settings['config_sync_directory'] = '../config/sync';

Further reading: https://www.drupal.org/docs/configuration-management/changing-the-storage-location-of-the-sync-directory

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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