1

A good enhancement in Drupal 8 is having list of yml file to import via installation in mymodule_root\config\install, but this means I can not reinstall a module because the configuration settings already exist in the active configuration.

Actually the problem is when uninstalling the module: The imported configuration settings, imported during installation, aren't waived.

screenshot

Test scenario

Put this sample .yml file in yourmodule_root\config\install\systme.site.yml.

name: 'Admissions at Adelaide'
mail: [email protected]
slogan: ''
page:
  403: ''
  404: ''
  front: caslogin
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en
1
  • I deleted the values in config table directly. Commented Dec 3, 2015 at 18:39

2 Answers 2

1

See How to remove mymodule configurations on uninstall for a best-practice solution.

Basically, you can enforce the dependency on your module in your configuration files. So when the module is uninstalled, it's associated configuration will be uninstalled as well.

0

I'm quite sure it's not best practice, but you may try to add a yourmodule.install file and add something like this:

function yourmodule_migrate_uninstall() {

  // Delete Configuration generated at at activation.
  $dir = DRUPAL_ROOT . DIRECTORY_SEPARATOR . drupal_get_path('module', 'yourmodule') . DIRECTORY_SEPARATOR . 'config/install';
  $files = file_scan_directory($dir, '/.*\.yml$/');

  foreach ($files as $file) {
    db_delete('config')
      ->condition('name', $file->name)
      ->execute();
  }
}

Better answers's are welcome ;)

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