function UpdateRegistry::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::__construct()
  2. 8.9.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::__construct()
  3. 11.x core/lib/Drupal/Core/Update/UpdateRegistry.php \Drupal\Core\Update\UpdateRegistry::__construct()

Constructs a new UpdateRegistry.

Parameters

string $root: The app root.

string $site_path: The site path.

array $module_list: An associative array whose keys are the names of installed modules.

\Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value: The key value store.

\Drupal\Core\Extension\ThemeHandlerInterface|bool|null $theme_handler: The theme handler.

string $update_type: The used update name.

File

core/lib/Drupal/Core/Update/UpdateRegistry.php, line 92

Class

UpdateRegistry
Provides all and missing update implementations.

Namespace

Drupal\Core\Update

Code

public function __construct($root, $site_path, $module_list, KeyValueStoreInterface $key_value, ThemeHandlerInterface|bool|null $theme_handler = NULL, string $update_type = 'post_update') {
    $this->root = $root;
    $this->sitePath = $site_path;
    if ($module_list !== [] && array_is_list($module_list)) {
        @trigger_error('Calling ' . __METHOD__ . '() with the $enabled_extensions argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. Use an associative array whose keys are the names of installed modules instead. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
        $module_list = \Drupal::service('module_handler')->getModuleList();
    }
    if ($theme_handler === NULL || is_bool($theme_handler)) {
        @trigger_error('Calling ' . __METHOD__ . '() with the $include_tests argument is deprecated in drupal:10.3.0 and is removed from drupal:11.0.0. See https://www.drupal.org/node/3423659', E_USER_DEPRECATED);
        $theme_handler = \Drupal::service('theme_handler');
    }
    $this->enabledExtensions = array_merge(array_keys($module_list), array_keys($theme_handler->listInfo()));
    $this->keyValue = $key_value;
    $this->updateType = $update_type;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.