Commit e37031e0 authored by catch's avatar catch
Browse files

Issue #3072702 by alexpott, Wim Leers, mikelutz, xjm, catch, Berdir, tedbow,...

Issue #3072702 by alexpott, Wim Leers, mikelutz, xjm, catch, Berdir, tedbow, webchick, shaal, Mixologic, heddn: Core extensions should not need to specify the new core_version_requirement in *.info.yml files so that 9.0.x can be installed
parent e0f9dba3
......@@ -1623,6 +1623,7 @@ services:
arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data']
info_parser:
class: Drupal\Core\Extension\InfoParser
arguments: ['@app.root']
twig:
class: Drupal\Core\Template\TwigEnvironment
arguments: ['@app.root', '@cache.default', '%twig_extension_hash%', '@state', '@twig.loader', '%twig.config%']
......
......@@ -314,7 +314,7 @@ protected function getProfiles($include_hidden = FALSE, $auto_select_distributio
$listing = new ExtensionDiscovery(getcwd(), FALSE);
$listing->setProfileDirectories([]);
$profiles = [];
$info_parser = new InfoParserDynamic();
$info_parser = new InfoParserDynamic(getcwd());
foreach ($listing->scan('profile') as $profile) {
$details = $info_parser->parse($profile->getPathname());
// Don't show hidden profiles.
......
......@@ -11,11 +11,33 @@
*/
class InfoParserDynamic implements InfoParserInterface {
/**
* The root directory of the Drupal installation.
*
* @var string
*/
protected $root;
/**
* The earliest Drupal version that supports the 'core_version_requirement'.
*/
const FIRST_CORE_VERSION_REQUIREMENT_SUPPORTED_VERSION = '8.7.7';
/**
* InfoParserDynamic constructor.
*
* @param string|null $app_root
* The root directory of the Drupal installation.
*/
public function __construct(string $app_root = NULL) {
if ($app_root === NULL) {
// @todo https://www.drupal.org/project/drupal/issues/3087975 Require
// $app_root argument.
\Drupal::hasService('app.root') ? (string) \Drupal::service('app.root') : DRUPAL_ROOT;
}
$this->root = $app_root;
}
/**
* {@inheritdoc}
*/
......@@ -34,13 +56,17 @@ public function parse($filename) {
if (!empty($missing_keys)) {
throw new InfoParserException('Missing required keys (' . implode(', ', $missing_keys) . ') in ' . $filename);
}
if ($parsed_info['type'] === 'profile' && isset($parsed_info['core_version_requirement'])) {
// @todo Support the 'core_version_requirement' key in profiles in
// https://www.drupal.org/node/3070401.
throw new InfoParserException("The 'core_version_requirement' key is not supported in profiles in $filename");
}
if (!isset($parsed_info['core']) && !isset($parsed_info['core_version_requirement'])) {
throw new InfoParserException("The 'core' or the 'core_version_requirement' key must be present in " . $filename);
if (strpos($filename, 'core/') === 0 || strpos($filename, $this->root . '/core/') === 0) {
// Core extensions do not need to specify core compatibility: they are
// by definition compatible so a sensible default is used. Core
// modules are allowed to provide these for testing purposes.
$parsed_info['core_version_requirement'] = \Drupal::VERSION;
}
else {
// Non-core extensions must specify core compatibility.
throw new InfoParserException("The 'core' or the 'core_version_requirement' key must be present in " . $filename);
}
}
if (isset($parsed_info['core']) && !preg_match("/^\d\.x$/", $parsed_info['core'])) {
throw new InfoParserException("Invalid 'core' value \"{$parsed_info['core']}\" in " . $filename);
......
......@@ -3,5 +3,4 @@ type: module
description: 'Perform tasks on specific events triggered within the system.'
package: Core
version: VERSION
core: 8.x
configure: entity.action.collection
......@@ -3,5 +3,4 @@ type: module
description: 'module used for testing ajax in action config entity forms.'
package: Core
version: VERSION
core: 8.x
hidden: true
......@@ -3,7 +3,6 @@ type: module
description: 'Aggregates syndicated content (RSS, RDF, and Atom feeds) from external sources.'
package: Core
version: VERSION
core: 8.x
configure: aggregator.admin_settings
dependencies:
- drupal:file
......
......@@ -3,4 +3,3 @@ type: module
description: 'Support module for aggregator related testing.'
package: Testing
version: VERSION
core: 8.x
......@@ -3,7 +3,6 @@ type: module
description: 'Provides default views for views aggregator tests.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- drupal:aggregator
- drupal:views
......@@ -3,5 +3,4 @@ type: module
description: 'Provides an automated way to run cron jobs, by executing them at the end of a server response.'
package: Core
version: VERSION
core: 8.x
configure: system.cron_settings
......@@ -3,5 +3,4 @@ type: module
description: 'Enables banning of IP addresses.'
package: Core
version: VERSION
core: 8.x
configure: ban.admin_page
......@@ -3,6 +3,5 @@ type: module
description: 'Provides the HTTP Basic authentication provider'
package: Web services
version: VERSION
core: 8.x
dependencies:
- drupal:user
......@@ -3,4 +3,3 @@ type: module
description: 'Support module for HTTP Basic Authentication testing.'
package: Testing
version: VERSION
core: 8.x
......@@ -3,4 +3,3 @@ type: module
description: 'Sends pages using the BigPipe technique that allows browsers to show them much faster.'
package: Core
version: VERSION
core: 8.x
......@@ -3,4 +3,3 @@ type: module
description: 'Support module for BigPipe regression testing.'
package: Testing
version: VERSION
core: 8.x
......@@ -3,4 +3,3 @@ type: module
description: 'Support module for BigPipe testing.'
package: Testing
version: VERSION
core: 8.x
......@@ -3,4 +3,3 @@ type: theme
base theme: stable
description: 'Theme for testing BigPipe edge cases.'
version: VERSION
core: 8.x
......@@ -3,5 +3,4 @@ type: module
description: 'Controls the visual building blocks a page is constructed with. Blocks are boxes of content rendered into an area, or region, of a web page.'
package: Core
version: VERSION
core: 8.x
configure: block.admin_display
......@@ -3,6 +3,5 @@ type: module
description: 'Provides test blocks.'
package: Testing
version: VERSION
core: 8.x
dependencies:
- drupal:block
......@@ -2,7 +2,6 @@ name: '<"Cat" & ''Mouse''>'
type: theme
base theme: stable
description: 'Theme for testing special characters in block admin.'
core: 8.x
regions:
content: Content
help: Help
......@@ -3,7 +3,6 @@ type: theme
base theme: stable
description: 'Theme for testing the block system'
version: VERSION
core: 8.x
regions:
sidebar_first: 'Left sidebar'
sidebar_second: 'Right sidebar'
......
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