From ebbc773c380793fa4e30f852815f9bfd60cc3eb5 Mon Sep 17 00:00:00 2001
From: Colan Schwartz <colan@58704.no-reply.drupal.org>
Date: Wed, 12 Oct 2016 13:59:02 -0400
Subject: [PATCH] Issue #2595809 by helmo, colan: Check for profiles' info.yml
 in D8, and only include .profile if it exists.

---
 platform/provision_drupal.drush.inc | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/platform/provision_drupal.drush.inc b/platform/provision_drupal.drush.inc
index 05a4977..a1ec021 100644
--- a/platform/provision_drupal.drush.inc
+++ b/platform/provision_drupal.drush.inc
@@ -393,13 +393,11 @@ function _provision_find_profiles() {
     }
     while (FALSE !== ($name = readdir($dir))) {
       $languages = array();
-      $file = "$profiles_subdir/$name/$name.profile";
-      if ($name == '..' || $name == '.' || !file_exists($file)) {
+      if ($name == '..' || $name == '.') {
         continue;
       }
       $profile = new stdClass();
       $profile->name = $name;
-      $profile->filename = $file;
 
       $profile->info = array();
 
@@ -420,6 +418,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 +429,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());
@@ -587,7 +591,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;
-- 
2.7.4

