Programmatically disable a module - Drupal 8

You can run the following code using drush eval or may be using the Devel module's provision to Execute PHP Code.

$module_data = \Drupal::config('core.extension')->get('module');

// Unset the modules you do not need. 
unset($module_data['dblog']); 
// Write the configuration. 
\Drupal::configFactory()->getEditable('core.extension')->set('module', $module_data)->save();

Comments

Popular posts from this blog

PHP - How to increase size of POST value in php

D8 KernelEvents constants

D8 - Attach file programmatically to a node