Commit 27349905 authored by webchick's avatar webchick

Issue #1848998 by dawehner, chx, xjm: Fixed Module/Bundle services not available in update.php.

parent 9fa3ce39
......@@ -633,6 +633,7 @@ function update_module_enable(array $modules) {
// installed module is always 0. Using 8000 here would be inconsistent
// since $module_update_8000() may involve a schema change, and we want
// to install the schema as it was before any updates were added.
module_load_install($module);
$function = $module . '_schema_0';
if (function_exists($function)) {
$schema = $function();
......
......@@ -108,4 +108,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_list_reset();
$this->assertTrue(module_exists('views'), 'Views is enabled after the upgrade.');
}
}
......@@ -2194,6 +2194,25 @@ function system_update_8045() {
}
}
/**
* Enable Views if the node listing is set as the frontpage.
*/
function system_update_8046() {
$front_page = config('system.site')->get('page.front');
if (!isset($front_page) || $front_page == 'node') {
update_module_enable(array('views'));
// Register views to the container, so views can use it's services.
$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.
......
......@@ -26,3 +26,17 @@ function views_schema() {
return $schema;
}
/**
* Provide an initial schema.
*
* @see update_module_enable().
*/
function views_schema_0() {
module_load_install('system');
// Add the cache_views_info and cache_views_results tables.
$cache_schema = system_schema_cache_8007();
$schema['cache_views_info'] = $cache_schema;
$schema['cache_views_results'] = $cache_schema;
return $schema;
}
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