qtools_profiler-8.x-1.x-dev/modules/qtools_cache_profiler/qtools_cache_profiler.install
modules/qtools_cache_profiler/qtools_cache_profiler.install
<?php
/**
* @file
* Install hooks.
*/
/**
* Implements hook_install().
*
* @see https://drupal.stackexchange.com/a/270273
*/
function qtools_cache_profiler_install() {
module_set_weight('qtools_cache_profiler', 1024);
$module_handler = \Drupal::moduleHandler();
$module_data = \Drupal::service('extension.list.module')->reset()->getList();
// Rebuild and reboot a new kernel. A simple DrupalKernel reboot is not
// sufficient, since the list of enabled modules might have been adjusted
// above due to changed code.
$files = [];
foreach ($module_data as $name => $extension) {
if ($extension->status) {
$files[$name] = $extension;
}
}
\Drupal::service('kernel')->updateModules($module_handler->getModuleList(), $files);
}
