You are here

public function ModuleInstaller::__construct in Drupal 9

Same name in this branch
  1. 9 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::__construct()
  2. 9 core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php \Drupal\Core\ProxyClass\Extension\ModuleInstaller::__construct()
Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Extension/ModuleInstaller.php \Drupal\Core\Extension\ModuleInstaller::__construct()

Constructs a new ModuleInstaller instance.

Parameters

string $root: The app root.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\DrupalKernelInterface $kernel: The drupal kernel.

\Drupal\Core\Database\Connection $connection: The database connection.

\Drupal\Core\Update\UpdateHookRegistry|null $update_registry: (Optional) The update registry service.

See also

\Drupal\Core\DrupalKernel

\Drupal\Core\CoreServiceProvider

File

core/lib/Drupal/Core/Extension/ModuleInstaller.php, line 88

Class

ModuleInstaller
Default implementation of the module installer.

Namespace

Drupal\Core\Extension

Code

public function __construct($root, ModuleHandlerInterface $module_handler, DrupalKernelInterface $kernel, Connection $connection = NULL, UpdateHookRegistry $update_registry = NULL) {
  $this->root = $root;
  $this->moduleHandler = $module_handler;
  $this->kernel = $kernel;
  if (!$connection) {
    @trigger_error('The database connection must be passed to ' . __METHOD__ . '(). Creating ' . __CLASS__ . ' without it is deprecated in drupal:9.2.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/2970993', E_USER_DEPRECATED);
    $connection = \Drupal::service('database');
  }
  $this->connection = $connection;
  if (!$update_registry) {
    @trigger_error('Calling ' . __METHOD__ . '() without the $update_registry argument is deprecated in drupal:9.3.0 and $update_registry argument will be required in drupal:10.0.0. See https://www.drupal.org/node/2124069', E_USER_DEPRECATED);
    $update_registry = \Drupal::service('update.update_hook_registry');
  }
  $this->updateRegistry = $update_registry;
}