You are here

function _config_installer_get_original_install_profile in Configuration installer 8

Gets the original install profile name.

Return value

string|null The name of the install profile from the sync configuration.

5 calls to _config_installer_get_original_install_profile()
config_installer_config_import_profile in ./config_installer.profile
Processes profile as part of configuration sync.
config_installer_fix_profile in ./config_installer.profile
Fixes configuration if the install profile has made changes in hook_install().
config_installer_install_uninstalled_profile_dependencies in ./config_installer.profile
Ensures all profile dependencies are created.
SiteConfigureForm::buildForm in src/Form/SiteConfigureForm.php
Form constructor.
SyncConfigureForm::validateForm in src/Form/SyncConfigureForm.php
Form validation handler.

File

./config_installer.profile, line 312
Enables modules and site configuration for a minimal site installation.

Code

function _config_installer_get_original_install_profile() {

  // In Drupal 8.3 the profile is written to config and not settings.
  $core = \Drupal::service('config.storage.sync')
    ->read('core.extension');
  if (isset($core['profile'])) {
    return $core['profile'];
  }
  $original_profile = NULL;

  // Profiles need to be extracted from the install list if they are there.
  // This is because profiles need to be installed after all the configuration
  // has been processed.
  $listing = new \Drupal\Core\Extension\ExtensionDiscovery(\Drupal::root());
  $listing
    ->setProfileDirectories([]);

  // Read directly from disk since the source storage in the config importer is
  // being altered to exclude profiles.
  $profiles = array_intersect_key($listing
    ->scan('profile'), $core['module']);
  if (!empty($profiles)) {

    // There can be only one.
    $original_profile = key($profiles);
  }
  return $original_profile;
}