Loading core/modules/system/src/Install/Requirements/SystemRequirements.php +40 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,36 @@ */ class SystemRequirements implements InstallRequirementsInterface { // cspell:ignore quickedit /** * An array of machine names of modules that were removed from Drupal core. */ public const DRUPAL_CORE_REMOVED_MODULE_LIST = [ 'action' => 'Action UI', 'book' => 'Book', 'aggregator' => 'Aggregator', 'ckeditor' => 'CKEditor', 'color' => 'Color', 'forum' => 'Forum', 'hal' => 'HAL', 'quickedit' => 'Quick Edit', 'rdf' => 'RDF', 'statistics' => 'Statistics', 'tour' => 'Tour', 'tracker' => 'Tracker', ]; /** * An array of machine names of themes that were removed from Drupal core. */ public const DRUPAL_CORE_REMOVED_THEME_LIST = [ 'bartik' => 'Bartik', 'classy' => 'Classy', 'seven' => 'Seven', 'stable' => 'Stable', ]; /** * {@inheritdoc} */ Loading Loading @@ -1142,7 +1172,7 @@ public static function checkRequirements(string $phase): array { // Look for removed core modules. $is_removed_module = function ($extension_name) use ($module_extension_list) { return !$module_extension_list->exists($extension_name) && array_key_exists($extension_name, DRUPAL_CORE_REMOVED_MODULE_LIST); && array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_MODULE_LIST); }; $removed_modules = array_filter(array_keys($extension_config->get('module')), $is_removed_module); if (!empty($removed_modules)) { Loading @@ -1150,7 +1180,7 @@ public static function checkRequirements(string $phase): array { foreach ($removed_modules as $removed_module) { $list[] = t('<a href=":url">@module</a>', [ ':url' => "https://www.drupal.org/project/$removed_module", '@module' => DRUPAL_CORE_REMOVED_MODULE_LIST[$removed_module], '@module' => static::DRUPAL_CORE_REMOVED_MODULE_LIST[$removed_module], ]); } $requirements['removed_module'] = $create_extension_incompatibility_list( Loading Loading @@ -1180,7 +1210,7 @@ public static function checkRequirements(string $phase): array { // Look for removed core themes. $is_removed_theme = function ($extension_name) use ($theme_extension_list) { return !$theme_extension_list->exists($extension_name) && array_key_exists($extension_name, DRUPAL_CORE_REMOVED_THEME_LIST); && array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_THEME_LIST); }; $removed_themes = array_filter(array_keys($extension_config->get('theme')), $is_removed_theme); if (!empty($removed_themes)) { Loading @@ -1188,7 +1218,7 @@ public static function checkRequirements(string $phase): array { foreach ($removed_themes as $removed_theme) { $list[] = t('<a href=":url">@theme</a>', [ ':url' => "https://www.drupal.org/project/$removed_theme", '@theme' => DRUPAL_CORE_REMOVED_THEME_LIST[$removed_theme], '@theme' => static::DRUPAL_CORE_REMOVED_THEME_LIST[$removed_theme], ]); } $requirements['removed_theme'] = $create_extension_incompatibility_list( Loading Loading @@ -1216,9 +1246,9 @@ public static function checkRequirements(string $phase): array { } // Look for missing modules. $is_missing_module = function ($extension_name) use ($module_extension_list) { return !$module_extension_list->exists($extension_name) && !in_array($extension_name, array_keys(DRUPAL_CORE_REMOVED_MODULE_LIST), TRUE); }; $is_missing_module = fn ($extension_name) => !$module_extension_list->exists($extension_name) && !array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_MODULE_LIST); $invalid_modules = array_filter(array_keys($extension_config->get('module')), $is_missing_module); if (!empty($invalid_modules)) { Loading @@ -1238,9 +1268,9 @@ public static function checkRequirements(string $phase): array { } // Look for invalid themes. $is_missing_theme = function ($extension_name) use (&$theme_extension_list) { return !$theme_extension_list->exists($extension_name) && !in_array($extension_name, array_keys(DRUPAL_CORE_REMOVED_THEME_LIST), TRUE); }; $is_missing_theme = fn ($extension_name) => !$theme_extension_list->exists($extension_name) && !array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_THEME_LIST); $invalid_themes = array_filter(array_keys($extension_config->get('theme')), $is_missing_theme); if (!empty($invalid_themes)) { $requirements['invalid_theme'] = $create_extension_incompatibility_list( Loading core/modules/system/system.install +0 −30 Original line number Diff line number Diff line Loading @@ -9,36 +9,6 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Update\EquivalentUpdate; // cspell:ignore quickedit /** * An array of machine names of modules that were removed from Drupal core. */ const DRUPAL_CORE_REMOVED_MODULE_LIST = [ 'action' => 'Action UI', 'book' => 'Book', 'aggregator' => 'Aggregator', 'ckeditor' => 'CKEditor', 'color' => 'Color', 'forum' => 'Forum', 'hal' => 'HAL', 'quickedit' => 'Quick Edit', 'rdf' => 'RDF', 'statistics' => 'Statistics', 'tour' => 'Tour', 'tracker' => 'Tracker', ]; /** * An array of machine names of themes that were removed from Drupal core. */ const DRUPAL_CORE_REMOVED_THEME_LIST = [ 'bartik' => 'Bartik', 'classy' => 'Classy', 'seven' => 'Seven', 'stable' => 'Stable', ]; /** * Implements hook_install(). */ Loading core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +11 −15 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Extension\Requirement\RequirementSeverity; use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\system\Install\Requirements\SystemRequirements; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\RequirementsPageTrait; use Drupal\TestTools\Extension\InfoWriterTrait; Loading Loading @@ -286,7 +287,7 @@ public function testExtensionCompatibilityChange(array $correct_info, array $bre } /** * Date provider for testExtensionCompatibilityChange(). * Data provider for testExtensionCompatibilityChange(). */ public static function providerExtensionCompatibilityChange() { $incompatible_module_message = "The following module is installed, but it is incompatible with Drupal " . \Drupal::VERSION . ":"; Loading Loading @@ -382,10 +383,10 @@ public function testMissingExtension(array $core, array $contrib): void { $error_url = 'https://www.drupal.org/node/3223395#s-recommendations-for-deprecated-modules'; $extension_base_info += ['package' => 'Core']; if ($type === 'module') { $removed_core_list = \DRUPAL_CORE_REMOVED_MODULE_LIST; $removed_core_list = SystemRequirements::DRUPAL_CORE_REMOVED_MODULE_LIST; } else { $removed_core_list = \DRUPAL_CORE_REMOVED_THEME_LIST; $removed_core_list = SystemRequirements::DRUPAL_CORE_REMOVED_THEME_LIST; } foreach ($extensions as $extension) { Loading Loading @@ -981,7 +982,7 @@ public function getSystemSchema() { * @internal */ protected function assertInstalledExtensionsConfig(string $extension_type, array $extension_machine_names): void { $extension_config = $this->container->get('config.factory')->getEditable('core.extension'); $extension_config = $this->container->get('config.factory')->get('core.extension'); foreach ($extension_machine_names as $extension_machine_name) { $this->assertSame(0, $extension_config->get("$extension_type.$extension_machine_name")); } Loading @@ -997,18 +998,16 @@ protected function assertInstalledExtensionsConfig(string $extension_type, array * @param array $extension_machine_names * An array of the extension machine names. * * @throws \Behat\Mink\Exception\ResponseTextException * * @internal */ protected function assertUpdateWithNoErrors(array $unexpected_error_texts, string $extension_type, array $extension_machine_names): void { $assert_session = $this->assertSession(); foreach ($unexpected_error_texts as $unexpected_error_text) { $this->assertSession()->pageTextNotContains($unexpected_error_text); $assert_session->pageTextNotContains($unexpected_error_text); } $this->drupalGet($this->updateUrl, ['external' => TRUE]); foreach ($unexpected_error_texts as $unexpected_error_text) { $this->assertSession()->pageTextNotContains($unexpected_error_text); $assert_session->pageTextNotContains($unexpected_error_text); } $this->updateRequirementsProblem(); $this->clickLink('Continue'); Loading @@ -1028,26 +1027,23 @@ protected function assertUpdateWithNoErrors(array $unexpected_error_texts, strin * @param array $test_error_urls * The URLs in the error texts. * * @throws \Behat\Mink\Exception\ExpectationException * @throws \Behat\Mink\Exception\ResponseTextException * * @internal */ protected function assertErrorOnUpdates(array $expected_error_texts, string $extension_type, array $extension_machine_names, array $test_error_urls): void { $assert_session = $this->assertSession(); foreach ($expected_error_texts as $expected_error_text) { $this->assertSession()->pageTextContains($expected_error_text); $assert_session->pageTextContains($expected_error_text); } foreach ($test_error_urls as $test_error_url) { $this->assertSession()->linkByHrefExists($test_error_url); $assert_session->linkByHrefExists($test_error_url); } // Reload the update page to ensure the extension with the breaking values // has not been uninstalled or otherwise affected. for ($reload = 0; $reload <= 1; $reload++) { for ($i = 0; $i < 2; $i++) { $this->drupalGet($this->updateUrl, ['external' => TRUE]); foreach ($expected_error_texts as $expected_error_text) { $this->assertSession()->pageTextContains($expected_error_text); $assert_session->pageTextContains($expected_error_text); } $assert_session->linkNotExists('Continue'); } Loading core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,7 @@ public function testCheckIncompatibility($additional_settings, $expected): void } /** * DataProvider for testCheckIncompatibility(). * Data provider for testCheckIncompatibility(). */ public static function providerCheckIncompatibility() { return [ Loading Loading
core/modules/system/src/Install/Requirements/SystemRequirements.php +40 −10 Original line number Diff line number Diff line Loading @@ -34,6 +34,36 @@ */ class SystemRequirements implements InstallRequirementsInterface { // cspell:ignore quickedit /** * An array of machine names of modules that were removed from Drupal core. */ public const DRUPAL_CORE_REMOVED_MODULE_LIST = [ 'action' => 'Action UI', 'book' => 'Book', 'aggregator' => 'Aggregator', 'ckeditor' => 'CKEditor', 'color' => 'Color', 'forum' => 'Forum', 'hal' => 'HAL', 'quickedit' => 'Quick Edit', 'rdf' => 'RDF', 'statistics' => 'Statistics', 'tour' => 'Tour', 'tracker' => 'Tracker', ]; /** * An array of machine names of themes that were removed from Drupal core. */ public const DRUPAL_CORE_REMOVED_THEME_LIST = [ 'bartik' => 'Bartik', 'classy' => 'Classy', 'seven' => 'Seven', 'stable' => 'Stable', ]; /** * {@inheritdoc} */ Loading Loading @@ -1142,7 +1172,7 @@ public static function checkRequirements(string $phase): array { // Look for removed core modules. $is_removed_module = function ($extension_name) use ($module_extension_list) { return !$module_extension_list->exists($extension_name) && array_key_exists($extension_name, DRUPAL_CORE_REMOVED_MODULE_LIST); && array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_MODULE_LIST); }; $removed_modules = array_filter(array_keys($extension_config->get('module')), $is_removed_module); if (!empty($removed_modules)) { Loading @@ -1150,7 +1180,7 @@ public static function checkRequirements(string $phase): array { foreach ($removed_modules as $removed_module) { $list[] = t('<a href=":url">@module</a>', [ ':url' => "https://www.drupal.org/project/$removed_module", '@module' => DRUPAL_CORE_REMOVED_MODULE_LIST[$removed_module], '@module' => static::DRUPAL_CORE_REMOVED_MODULE_LIST[$removed_module], ]); } $requirements['removed_module'] = $create_extension_incompatibility_list( Loading Loading @@ -1180,7 +1210,7 @@ public static function checkRequirements(string $phase): array { // Look for removed core themes. $is_removed_theme = function ($extension_name) use ($theme_extension_list) { return !$theme_extension_list->exists($extension_name) && array_key_exists($extension_name, DRUPAL_CORE_REMOVED_THEME_LIST); && array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_THEME_LIST); }; $removed_themes = array_filter(array_keys($extension_config->get('theme')), $is_removed_theme); if (!empty($removed_themes)) { Loading @@ -1188,7 +1218,7 @@ public static function checkRequirements(string $phase): array { foreach ($removed_themes as $removed_theme) { $list[] = t('<a href=":url">@theme</a>', [ ':url' => "https://www.drupal.org/project/$removed_theme", '@theme' => DRUPAL_CORE_REMOVED_THEME_LIST[$removed_theme], '@theme' => static::DRUPAL_CORE_REMOVED_THEME_LIST[$removed_theme], ]); } $requirements['removed_theme'] = $create_extension_incompatibility_list( Loading Loading @@ -1216,9 +1246,9 @@ public static function checkRequirements(string $phase): array { } // Look for missing modules. $is_missing_module = function ($extension_name) use ($module_extension_list) { return !$module_extension_list->exists($extension_name) && !in_array($extension_name, array_keys(DRUPAL_CORE_REMOVED_MODULE_LIST), TRUE); }; $is_missing_module = fn ($extension_name) => !$module_extension_list->exists($extension_name) && !array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_MODULE_LIST); $invalid_modules = array_filter(array_keys($extension_config->get('module')), $is_missing_module); if (!empty($invalid_modules)) { Loading @@ -1238,9 +1268,9 @@ public static function checkRequirements(string $phase): array { } // Look for invalid themes. $is_missing_theme = function ($extension_name) use (&$theme_extension_list) { return !$theme_extension_list->exists($extension_name) && !in_array($extension_name, array_keys(DRUPAL_CORE_REMOVED_THEME_LIST), TRUE); }; $is_missing_theme = fn ($extension_name) => !$theme_extension_list->exists($extension_name) && !array_key_exists($extension_name, static::DRUPAL_CORE_REMOVED_THEME_LIST); $invalid_themes = array_filter(array_keys($extension_config->get('theme')), $is_missing_theme); if (!empty($invalid_themes)) { $requirements['invalid_theme'] = $create_extension_incompatibility_list( Loading
core/modules/system/system.install +0 −30 Original line number Diff line number Diff line Loading @@ -9,36 +9,6 @@ use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Update\EquivalentUpdate; // cspell:ignore quickedit /** * An array of machine names of modules that were removed from Drupal core. */ const DRUPAL_CORE_REMOVED_MODULE_LIST = [ 'action' => 'Action UI', 'book' => 'Book', 'aggregator' => 'Aggregator', 'ckeditor' => 'CKEditor', 'color' => 'Color', 'forum' => 'Forum', 'hal' => 'HAL', 'quickedit' => 'Quick Edit', 'rdf' => 'RDF', 'statistics' => 'Statistics', 'tour' => 'Tour', 'tracker' => 'Tracker', ]; /** * An array of machine names of themes that were removed from Drupal core. */ const DRUPAL_CORE_REMOVED_THEME_LIST = [ 'bartik' => 'Bartik', 'classy' => 'Classy', 'seven' => 'Seven', 'stable' => 'Stable', ]; /** * Implements hook_install(). */ Loading
core/modules/system/tests/src/Functional/UpdateSystem/UpdateScriptTest.php +11 −15 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Extension\Requirement\RequirementSeverity; use Drupal\Core\Url; use Drupal\language\Entity\ConfigurableLanguage; use Drupal\system\Install\Requirements\SystemRequirements; use Drupal\Tests\BrowserTestBase; use Drupal\Tests\RequirementsPageTrait; use Drupal\TestTools\Extension\InfoWriterTrait; Loading Loading @@ -286,7 +287,7 @@ public function testExtensionCompatibilityChange(array $correct_info, array $bre } /** * Date provider for testExtensionCompatibilityChange(). * Data provider for testExtensionCompatibilityChange(). */ public static function providerExtensionCompatibilityChange() { $incompatible_module_message = "The following module is installed, but it is incompatible with Drupal " . \Drupal::VERSION . ":"; Loading Loading @@ -382,10 +383,10 @@ public function testMissingExtension(array $core, array $contrib): void { $error_url = 'https://www.drupal.org/node/3223395#s-recommendations-for-deprecated-modules'; $extension_base_info += ['package' => 'Core']; if ($type === 'module') { $removed_core_list = \DRUPAL_CORE_REMOVED_MODULE_LIST; $removed_core_list = SystemRequirements::DRUPAL_CORE_REMOVED_MODULE_LIST; } else { $removed_core_list = \DRUPAL_CORE_REMOVED_THEME_LIST; $removed_core_list = SystemRequirements::DRUPAL_CORE_REMOVED_THEME_LIST; } foreach ($extensions as $extension) { Loading Loading @@ -981,7 +982,7 @@ public function getSystemSchema() { * @internal */ protected function assertInstalledExtensionsConfig(string $extension_type, array $extension_machine_names): void { $extension_config = $this->container->get('config.factory')->getEditable('core.extension'); $extension_config = $this->container->get('config.factory')->get('core.extension'); foreach ($extension_machine_names as $extension_machine_name) { $this->assertSame(0, $extension_config->get("$extension_type.$extension_machine_name")); } Loading @@ -997,18 +998,16 @@ protected function assertInstalledExtensionsConfig(string $extension_type, array * @param array $extension_machine_names * An array of the extension machine names. * * @throws \Behat\Mink\Exception\ResponseTextException * * @internal */ protected function assertUpdateWithNoErrors(array $unexpected_error_texts, string $extension_type, array $extension_machine_names): void { $assert_session = $this->assertSession(); foreach ($unexpected_error_texts as $unexpected_error_text) { $this->assertSession()->pageTextNotContains($unexpected_error_text); $assert_session->pageTextNotContains($unexpected_error_text); } $this->drupalGet($this->updateUrl, ['external' => TRUE]); foreach ($unexpected_error_texts as $unexpected_error_text) { $this->assertSession()->pageTextNotContains($unexpected_error_text); $assert_session->pageTextNotContains($unexpected_error_text); } $this->updateRequirementsProblem(); $this->clickLink('Continue'); Loading @@ -1028,26 +1027,23 @@ protected function assertUpdateWithNoErrors(array $unexpected_error_texts, strin * @param array $test_error_urls * The URLs in the error texts. * * @throws \Behat\Mink\Exception\ExpectationException * @throws \Behat\Mink\Exception\ResponseTextException * * @internal */ protected function assertErrorOnUpdates(array $expected_error_texts, string $extension_type, array $extension_machine_names, array $test_error_urls): void { $assert_session = $this->assertSession(); foreach ($expected_error_texts as $expected_error_text) { $this->assertSession()->pageTextContains($expected_error_text); $assert_session->pageTextContains($expected_error_text); } foreach ($test_error_urls as $test_error_url) { $this->assertSession()->linkByHrefExists($test_error_url); $assert_session->linkByHrefExists($test_error_url); } // Reload the update page to ensure the extension with the breaking values // has not been uninstalled or otherwise affected. for ($reload = 0; $reload <= 1; $reload++) { for ($i = 0; $i < 2; $i++) { $this->drupalGet($this->updateUrl, ['external' => TRUE]); foreach ($expected_error_texts as $expected_error_text) { $this->assertSession()->pageTextContains($expected_error_text); $assert_session->pageTextContains($expected_error_text); } $assert_session->linkNotExists('Continue'); } Loading
core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php +1 −1 Original line number Diff line number Diff line Loading @@ -249,7 +249,7 @@ public function testCheckIncompatibility($additional_settings, $expected): void } /** * DataProvider for testCheckIncompatibility(). * Data provider for testCheckIncompatibility(). */ public static function providerCheckIncompatibility() { return [ Loading