Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294800

DatabaseDriver::load should have a non-service alternative for class loading

$
0
0

Problem/Motivation

Database drivers should be reachable even if no container is available.

This code in database caters for that

  /**
   * Returns the list provider for available database drivers.
   *
   * @return \Drupal\Core\Extension\DatabaseDriverList
   *   The list provider for available database drivers.
   */
  public static function getDriverList(): DatabaseDriverList {
    if (\Drupal::hasContainer() && \Drupal::hasService('extension.list.database_driver')) {
      return \Drupal::service('extension.list.database_driver');
    }
    else {
      return new DatabaseDriverList(DRUPAL_ROOT, 'database_driver', new NullBackend('database_driver'));
    }
  }

but the non-service alternative is failed later when DatabaseDriver::load() tries to access the class_loader service.

Steps to reproduce

Found this while trying to adjust Drush's interactive site:install command, that runs when no db-url option is passed in.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


Viewing all articles
Browse latest Browse all 294800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>