Chris@0: getMessage()); Chris@0: } Chris@0: $missing_keys = array_diff($this->getRequiredKeys(), array_keys($parsed_info)); Chris@0: if (!empty($missing_keys)) { Chris@0: throw new InfoParserException('Missing required keys (' . implode(', ', $missing_keys) . ') in ' . $filename); Chris@0: } Chris@0: if (isset($parsed_info['version']) && $parsed_info['version'] === 'VERSION') { Chris@0: $parsed_info['version'] = \Drupal::VERSION; Chris@0: } Chris@17: // Special backwards compatible handling profiles and their 'dependencies' Chris@17: // key. Chris@17: if ($parsed_info['type'] === 'profile' && isset($parsed_info['dependencies']) && !array_key_exists('install', $parsed_info)) { Chris@17: // Only trigger the deprecation message if we are actually using the Chris@17: // profile with the missing 'install' key. This avoids triggering the Chris@17: // deprecation when scanning all the available install profiles. Chris@17: global $install_state; Chris@17: if (isset($install_state['parameters']['profile'])) { Chris@17: $pattern = '@' . preg_quote(DIRECTORY_SEPARATOR . $install_state['parameters']['profile'] . '.info.yml') . '$@'; Chris@17: if (preg_match($pattern, $filename)) { Chris@17: @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); Chris@17: } Chris@17: } Chris@17: // Move dependencies to install so that if a profile has both Chris@17: // dependencies and install then dependencies are real. Chris@17: $parsed_info['install'] = $parsed_info['dependencies']; Chris@17: $parsed_info['dependencies'] = []; Chris@17: } Chris@0: } Chris@0: return $parsed_info; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns an array of keys required to exist in .info.yml file. Chris@0: * Chris@0: * @return array Chris@0: * An array of required keys. Chris@0: */ Chris@0: protected function getRequiredKeys() { Chris@0: return ['type', 'core', 'name']; Chris@0: } Chris@0: Chris@0: }