Skip to content

Instantly share code, notes, and snippets.

@froboy
Created October 30, 2018 21:05
Show Gist options
  • Save froboy/088db3244949045ba822dd8e8300bd6a to your computer and use it in GitHub Desktop.
Save froboy/088db3244949045ba822dd8e8300bd6a to your computer and use it in GitHub Desktop.
Switch from standard to config_installer with an existing db on Drupal 8, via https://www.drupal.org/project/drupal/issues/2677722
<?php
/**
* @file
* Install file for the Custom Module module.
*/
/**
* Ensure site is using 'config_installer' profile.
*/
function custom_module_update_8001(&$sandbox) {
\Drupal::configFactory()->getEditable('core.extension')
->set('profile', 'config_installer')
->save();
drupal_flush_all_caches();
\Drupal::service('module_installer')->install(['config_installer']);
\Drupal::service('module_installer')->uninstall(['standard']);
$sc = \Drupal::keyValue('system.schema');
if ($sc->get('standard')) {
$sc->delete('standard');
}
drupal_flush_all_caches();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment