diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index d228917c41..4cf4dba37b 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -294,7 +294,13 @@ function template_preprocess_system_themes_page(&$variables) { // Make sure to provide feedback on compatibility. $current_theme['incompatible'] = ''; if (!empty($theme->incompatible_core)) { - $current_theme['incompatible'] = t("This theme is not compatible with Drupal @core_version. Check that the .info.yml file contains the correct 'core' value.", ['@core_version' => \Drupal::CORE_COMPATIBILITY]); + if (isset($theme->info['core'])) { + $current_theme['incompatible'] = t("This theme is not compatible with Drupal @core_version. It is only compatible with Drupal versions that satisfy this constraint: @core_constraint", ['@core_version' => \Drupal::VERSION, '@core_constraint' => $theme->info['core']]); + } + else { + $current_theme['incompatible'] = t("This theme must declare a 'core' value in its .info.yml file."); + } + } elseif (!empty($theme->incompatible_region)) { $current_theme['incompatible'] = t("This theme is missing a 'content' region."); diff --git a/core/modules/update/update.module b/core/modules/update/update.module index 1327944481..c07ad7a6cb 100644 --- a/core/modules/update/update.module +++ b/core/modules/update/update.module @@ -11,6 +11,7 @@ * ability to install contributed modules and themes via an user interface. */ +use Drupal\Component\Version\DrupalSemver; use Drupal\Core\File\Exception\FileException; use Drupal\Core\Link; use Drupal\Core\Url; @@ -699,7 +700,7 @@ function update_verify_update_archive($project, $archive_file, $directory) { $info = \Drupal::service('info_parser')->parse($file->uri); // If the module or theme is incompatible with Drupal core, set an error. - if (empty($info['core']) || $info['core'] != \Drupal::CORE_COMPATIBILITY) { + if (empty($info['core']) || !DrupalSemver::satisfies(\Drupal::VERSION, $info['core'])) { $incompatible[] = !empty($info['name']) ? $info['name'] : t('Unknown'); } else { @@ -717,7 +718,7 @@ function update_verify_update_archive($project, $archive_file, $directory) { '%archive_file contains a version of %names that is not compatible with Drupal @version.', '%archive_file contains versions of modules or themes that are not compatible with Drupal @version: %names', [ - '@version' => \Drupal::CORE_COMPATIBILITY, + '@version' => \Drupal::VERSION, '%archive_file' => $file_system->basename($archive_file), '%names' => implode(', ', $incompatible), ]