Patched to Drupal 8.4.8 level. See https://www.drupal.org/sa-core-2018-004 and patch...
[yaffs-website] / web / core / lib / Drupal / Core / Extension / ModuleInstallerInterface.php
1 <?php
2
3 namespace Drupal\Core\Extension;
4
5 /**
6  * Provides the installation of modules with creating the db schema and more.
7  */
8 interface ModuleInstallerInterface {
9
10   /**
11    * Installs a given list of modules.
12    *
13    * Order of events:
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().
20    *
21    * To install test modules add
22    * @code
23    * $settings['extension_discovery_scan_tests'] = TRUE;
24    * @endcode
25    * to your settings.php.
26    *
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.
33    *
34    * @return bool
35    *   TRUE if the modules were successfully installed.
36    *
37    * @throws \Drupal\Core\Extension\MissingDependencyException
38    *   Thrown when a requested module, or a dependency of one, can not be found.
39    *
40    * @see hook_module_preinstall()
41    * @see hook_install()
42    * @see hook_modules_installed()
43    */
44   public function install(array $module_list, $enable_dependencies = TRUE);
45
46   /**
47    * Uninstalls a given list of modules.
48    *
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.
55    *
56    * @return bool
57    *   FALSE if one or more dependencies are missing, TRUE otherwise.
58    *
59    * @see hook_module_preuninstall()
60    * @see hook_uninstall()
61    * @see hook_modules_uninstalled()
62    */
63   public function uninstall(array $module_list, $uninstall_dependents = TRUE);
64
65   /**
66    * Adds module a uninstall validator.
67    *
68    * @param \Drupal\Core\Extension\ModuleUninstallValidatorInterface $uninstall_validator
69    *   The uninstall validator to add.
70    */
71   public function addUninstallValidator(ModuleUninstallValidatorInterface $uninstall_validator);
72
73   /**
74    * Determines whether a list of modules can be uninstalled.
75    *
76    * @param string[] $module_list
77    *   An array of module names.
78    *
79    * @return string[]
80    *   An array of reasons the module can not be uninstalled, empty if it can.
81    */
82   public function validateUninstall(array $module_list);
83
84 }