3 namespace Drupal\Core\Extension;
6 * Provides the installation of modules with creating the db schema and more.
8 interface ModuleInstallerInterface {
11 * Installs a given list of modules.
14 * - Gather and add module dependencies to $module_list (if applicable).
15 * - For each module that is being installed:
16 * - Invoke hook_module_preinstall().
17 * - Install module schema and update system registries and caches.
18 * - Invoke hook_install() and add it to the list of installed modules.
19 * - Invoke hook_modules_installed().
21 * To install test modules add
23 * $settings['extension_discovery_scan_tests'] = TRUE;
25 * to your settings.php.
27 * @param string[] $module_list
28 * An array of module names.
29 * @param bool $enable_dependencies
30 * (optional) If TRUE, dependencies will automatically be installed in the
31 * correct order. This incurs a significant performance cost, so use FALSE
32 * if you know $module_list is already complete.
35 * TRUE if the modules were successfully installed.
37 * @throws \Drupal\Core\Extension\MissingDependencyException
38 * Thrown when a requested module, or a dependency of one, can not be found.
40 * @see hook_module_preinstall()
42 * @see hook_modules_installed()
44 public function install(array $module_list, $enable_dependencies = TRUE);
47 * Uninstalls a given list of modules.
49 * @param string[] $module_list
50 * The modules to uninstall.
51 * @param bool $uninstall_dependents
52 * (optional) If TRUE, dependent modules will automatically be uninstalled
53 * in the correct order. This incurs a significant performance cost, so use
54 * FALSE if you know $module_list is already complete.
57 * FALSE if one or more dependencies are missing, TRUE otherwise.
59 * @see hook_module_preuninstall()
60 * @see hook_uninstall()
61 * @see hook_modules_uninstalled()
63 public function uninstall(array $module_list, $uninstall_dependents = TRUE);
66 * Adds module a uninstall validator.
68 * @param \Drupal\Core\Extension\ModuleUninstallValidatorInterface $uninstall_validator
69 * The uninstall validator to add.
71 public function addUninstallValidator(ModuleUninstallValidatorInterface $uninstall_validator);
74 * Determines whether a list of modules can be uninstalled.
76 * @param string[] $module_list
77 * An array of module names.
80 * An array of reasons the module can not be uninstalled, empty if it can.
82 public function validateUninstall(array $module_list);