diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 5f04f20..8d94cb9 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -7,6 +7,7 @@ use Drupal\Core\Config\FileStorage; use Drupal\Core\DrupalKernel; use Drupal\Core\CoreServiceProvider; +use Drupal\Core\SystemListing; use Drupal\Core\Database\Database; use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Database\Install\TaskException; @@ -493,7 +494,8 @@ function install_begin_request(&$install_state) { } // Add the list of available profiles to the installation state. - $install_state['profiles'] += drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); + $listing = new SystemListing(); + $install_state['profiles'] += $listing->scan('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\.profile$/', 'profiles'); if ($profile = _install_select_profile($install_state)) { $install_state['parameters']['profile'] = $profile; diff --git a/core/lib/Drupal/Core/SystemListingInfo.php b/core/lib/Drupal/Core/SystemListingInfo.php index 8e60503..d302699 100644 --- a/core/lib/Drupal/Core/SystemListingInfo.php +++ b/core/lib/Drupal/Core/SystemListingInfo.php @@ -19,14 +19,6 @@ class SystemListingInfo extends SystemListing { */ protected function profiles($directory) { $searchdir = array(); - // If install.php is invoked with a ?profile= query parameter, then - // $install_state['parameters']['profile'] will contain that value already, - // drupal_get_profile() will return it, and the below calls to - // drupal_get_path() will call into drupal_get_filename(), which triggers an - // infinite recursion. - if (drupal_installation_attempted() && empty($GLOBALS['install_state']['profiles'])) { - return $searchdir; - } // The 'core/profiles' directory contains pristine collections of modules // and themes as provided by a distribution. It is pristine in the same // way that the 'core/modules' directory is pristine for core; users diff --git a/core/modules/system/lib/Drupal/system/Tests/Installer/DistributionProfileTest.php b/core/modules/system/lib/Drupal/system/Tests/Installer/DistributionProfileTest.php new file mode 100644 index 0000000..66fae27 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Installer/DistributionProfileTest.php @@ -0,0 +1,72 @@ + 'Distribution installation profile test', + 'description' => 'Tests distribution profile support.', + 'group' => 'Installer', + ); + } + + protected function setUp() { + $this->info = array( + 'type' => 'profile', + 'core' => \Drupal::CORE_COMPATIBILITY, + 'name' => 'Distribution profile', + 'distribution' => array( + 'name' => 'Drupal On Steroids', + 'install' => array( + 'theme' => 'bartik', + ), + ), + ); + $path = DRUPAL_ROOT . '/' . $this->siteDirectory . '/profiles/steroids'; + // File API functions are not available yet. + mkdir($path, 0777, TRUE); + file_put_contents("$path/steroids.info.yml", Yaml::dump($this->info, PHP_INT_MAX, 2)); + file_put_contents("$path/steroids.profile", "assertRaw($this->info['distribution']['name']); + // Verify that the requested theme is used. + $this->assertRaw('bartik'); + + parent::setUpLanguage(); + } + + /** + * Overrides InstallerTest::setUpProfile(). + */ + protected function setUpProfile() { + // This step is skipped, because there is a distribution profile. + } + +}