diff core/lib/Drupal/Core/Extension/InfoParserDynamic.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 4c8ae668cc8c
children
line wrap: on
line diff
--- a/core/lib/Drupal/Core/Extension/InfoParserDynamic.php	Tue Jul 10 15:07:59 2018 +0100
+++ b/core/lib/Drupal/Core/Extension/InfoParserDynamic.php	Thu Feb 28 13:21:36 2019 +0000
@@ -31,6 +31,24 @@
       if (isset($parsed_info['version']) && $parsed_info['version'] === 'VERSION') {
         $parsed_info['version'] = \Drupal::VERSION;
       }
+      // Special backwards compatible handling profiles and their 'dependencies'
+      // key.
+      if ($parsed_info['type'] === 'profile' && isset($parsed_info['dependencies']) && !array_key_exists('install', $parsed_info)) {
+        // Only trigger the deprecation message if we are actually using the
+        // profile with the missing 'install' key. This avoids triggering the
+        // deprecation when scanning all the available install profiles.
+        global $install_state;
+        if (isset($install_state['parameters']['profile'])) {
+          $pattern = '@' . preg_quote(DIRECTORY_SEPARATOR . $install_state['parameters']['profile'] . '.info.yml') . '$@';
+          if (preg_match($pattern, $filename)) {
+            @trigger_error("The install profile $filename only implements a 'dependencies' key. As of Drupal 8.6.0 profile's support a new 'install' key for modules that should be installed but not depended on. See https://www.drupal.org/node/2952947.", E_USER_DEPRECATED);
+          }
+        }
+        // Move dependencies to install so that if a profile has both
+        // dependencies and install then dependencies are real.
+        $parsed_info['install'] = $parsed_info['dependencies'];
+        $parsed_info['dependencies'] = [];
+      }
     }
     return $parsed_info;
   }