diff --git a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php index 20162e9..0fe556f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Upgrade/SystemUpgradePathTest.php @@ -102,4 +102,16 @@ public function testVariableUpgrade() { } } } + + /** + * Check whether views got enabled. + */ + public function testFrontpageUpgrade() { + $this->assertTrue($this->performUpgrade(), 'The upgrade was completed successfully.'); + + // Reset the module enable list to get the current result. + $module_exists = module_list('module_enabled', NULL, TRUE); + $this->assertTrue($module_exists, 'Views is enabled after the upgrade.'); + } + } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 06935d1..040e94a 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2338,6 +2338,23 @@ function system_update_8042() { } /** + * Enable Views if the node listing is set as the frontpage. + */ +function system_update_8043() { + $front_page = config('system.site')->get('page.front'); + if (!isset($front_page) || $front_page == 'node') { + update_module_enable(array('views')); + $module_list = drupal_container()->getParameter('container.modules'); + drupal_load('module', 'views'); + + drupal_container()->get('kernel')->updateModules(array_keys($module_list), array('views' => 'core/modules/views/views.module')); + + // This does not fire a hook just calls views. + config_install_default_config('module', 'views'); + } +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */