Commit 5de479ce authored by colan's avatar colan Committed by helmo

Issue #2595809 by colan, helmo: Find (d8) profiles without a .profile

parent f49ad95a
......@@ -377,6 +377,8 @@ function _provision_drupal_rebuild_caches() {
* Find available profiles on this platform.
*/
function _provision_find_profiles() {
$profiles = array();
if (drush_drupal_major_version() >= 8) {
include_once('core/includes/install.inc');
$profiles_subdirs[] = "./core/profiles";
......@@ -386,21 +388,21 @@ function _provision_find_profiles() {
include_once('includes/install.inc');
$profiles_subdirs[] = "./profiles";
}
foreach($profiles_subdirs as $profiles_subdir) {
if (!$dir = opendir($profiles_subdir)) {
drush_log(dt("Cannot find profiles directory"), 'error');
return FALSE;
}
while (FALSE !== ($name = readdir($dir))) {
$languages = array();
$file = "$profiles_subdir/$name/$name.profile";
if ($name == '..' || $name == '.' || !file_exists($file)) {
if (($name == '..') || ($name == '.') || (!is_dir("$profiles_subdir/$name"))) {
continue;
}
$profile = new stdClass();
$profile->name = $name;
$profile->filename = $file;
$profile->info = array();
if (drush_drupal_major_version() >= 8) {
......@@ -420,6 +422,7 @@ function _provision_find_profiles() {
if (!empty($profile->info['name'])) {
$profile->name = $profile->info['name'];
}
$profile->filename = $yaml_file;
}
else {
$info_file = "$profiles_subdir/$name/$name.info";
......@@ -430,9 +433,14 @@ function _provision_find_profiles() {
continue;
}
}
$profile->filename = $info_file;
}
// Include code from the profile.
if (file_exists($profile_file = "$profiles_subdir/$name/$name.profile")) {
require_once($profile_file);
}
require_once($profile->filename);
$func = $profile->name . "_profile_details";
if (function_exists($func)) {
$profile->info = array_merge($profile->info, $func());
......@@ -457,12 +465,11 @@ function _provision_find_profiles() {
$profile->info['old_short_name'] = 'default';
}
$return[$name] = $profile;
$profiles[$name] = $profile;
drush_log(dt('Found install profile %name', array('%name' => $name)));
}
}
return $return;
return $profiles;
}
function provision_drupal_find_sites() {
......@@ -587,7 +594,7 @@ function provision_find_packages() {
// Iterate through the install profiles, finding the profile specific packages
foreach ($profiles as $profile => $info) {
if (!$info->version) {
if (empty($info->version)) {
$info->version = drush_drupal_version();
}
$packages['base']['profiles'][$profile] = $info;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment