InstallerKernel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace Drupal\Core\Installer;
  3. use Drupal\Core\DrupalKernel;
  4. /**
  5. * Extend DrupalKernel to handle force some kernel behaviors.
  6. */
  7. class InstallerKernel extends DrupalKernel {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. protected function initializeContainer() {
  12. // Always force a container rebuild.
  13. $this->containerNeedsRebuild = TRUE;
  14. $container = parent::initializeContainer();
  15. return $container;
  16. }
  17. /**
  18. * Reset the bootstrap config storage.
  19. *
  20. * Use this from a database driver runTasks() if the method overrides the
  21. * bootstrap config storage. Normally the bootstrap config storage is not
  22. * re-instantiated during a single install request. Most drivers will not
  23. * need this method.
  24. *
  25. * @see \Drupal\Core\Database\Install\Tasks::runTasks()
  26. */
  27. public function resetConfigStorage() {
  28. $this->configStorage = NULL;
  29. }
  30. /**
  31. * Returns the active configuration storage used during early install.
  32. *
  33. * This override changes the visibility so that the installer can access
  34. * config storage before the container is properly built.
  35. *
  36. * @return \Drupal\Core\Config\StorageInterface
  37. * The config storage.
  38. */
  39. public function getConfigStorage() {
  40. return parent::getConfigStorage();
  41. }
  42. /**
  43. * {@inheritdoc}
  44. */
  45. public function getInstallProfile() {
  46. global $install_state;
  47. if ($install_state && empty($install_state['installation_finished'])) {
  48. // If the profile has been selected return it.
  49. if (isset($install_state['parameters']['profile'])) {
  50. $profile = $install_state['parameters']['profile'];
  51. }
  52. else {
  53. $profile = NULL;
  54. }
  55. }
  56. else {
  57. $profile = parent::getInstallProfile();
  58. }
  59. return $profile;
  60. }
  61. }