Change record status: 
Project: 
Introduced in branch: 
8.x
Description: 

Procedural module/hook system functions have been replaced with a dedicated class/service.

Within other classes/services and also tests, you should exclusively use the new 'module_handler' service; e.g., like this:

-  $module_list = module_list();
+  $module_list = $this->container->get('module_handler')->getModuleList();

See Drupal\Core\Extension\ModuleHandlerInterface
and Drupal\Core\Extension\ModuleInstallerInterface
for the complete list of public methods.

Required code changes

Drupal 7 Drupal 8
module_load_all($bootstrap = FALSE)
module_load_all($bootstrap = TRUE)
module_load_all($bootstrap = NULL)
module_load_all($bootstrap, $reset = TRUE)
\Drupal::moduleHandler()->loadAll()
\Drupal::moduleHandler()->loadBootstrapModules()
\Drupal::moduleHandler()->isLoaded()
module_list($type = 'module_enabled')
module_list($type = 'bootstrap')
module_list($type, $fixed_list = array(...))
module_list($type, $fixed_list, $reset = TRUE)
\Drupal::moduleHandler()->getModuleList()
\Drupal::moduleHandler()->getBootstrapModules()
\Drupal::moduleHandler()->setModuleList()
module_list_reset()
system_list('module_enabled')
system_list('bootstrap')
\Drupal::moduleHandler()->getModuleList()
\Drupal::moduleHandler()->getBootstrapModules()
system_list_reset()

In tests:

$this->rebuildContainer()
_module_build_dependencies($files)
\Drupal::moduleHandler()->buildModuleDependencies($files)
module_exists($module)
\Drupal::moduleHandler()->moduleExists($module)
module_load_all_includes($type, $name = NULL)
\Drupal::moduleHandler()->loadAllIncludes($type, $name = NULL)
module_hook($module, $hook)
\Drupal::moduleHandler()->implementsHook($module, $hook)
module_implements($hook)
\Drupal::moduleHandler()->getImplementations($hook)
module_implements_reset()
\Drupal::moduleHandler()->resetImplementations()
module_hook_info()
module_invoke($module, $hook[, $arg1])
\Drupal::moduleHandler()->invoke($module, $hook, $args = array())
module_invoke_all($hook)
\Drupal::moduleHandler()->invokeAll($hook, $args = array())
drupal_alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
\Drupal::moduleHandler()->alter($type, &$data, &$context1 = NULL, &$context2 = NULL)
module_install($module_list, $enable_dependencies)
module_enable($module_list, $enable_dependencies)
\Drupal::service('module_installer')->install($module_list, $enable_dependencies)
module_uninstall($module_list, $uninstall_dependents)
\Drupal::service('module_installer')->uninstall($module_list, $uninstall_dependents)

Note that since Drupal-7.22 drupal_alter() accepted 3 context parameters. ModuleHandler::alter() only has 2 context parameters. For more info see: https://drupal.org/node/1882722.

A few procedural functions still exist as wrappers, but are marked as @deprecated and are scheduled for removal.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done