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