diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index d4f32e1..676a948 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2289,10 +2289,6 @@ function _drupal_exception_handler($exception) { * Sets up the script environment and loads settings.php. */ function _drupal_bootstrap_configuration() { - // Set the Drupal custom error handler. - set_error_handler('_drupal_error_handler'); - set_exception_handler('_drupal_exception_handler'); - drupal_environment_initialize(); // Start a page timer: timer_start('page'); @@ -2307,6 +2303,11 @@ function _drupal_bootstrap_configuration() { // Load the procedural configuration system helper functions. require_once DRUPAL_ROOT . '/core/includes/config.inc'; + + // Set the Drupal custom error handler. (requires config()) + set_error_handler('_drupal_error_handler'); + set_exception_handler('_drupal_exception_handler'); + // Redirect the user to the installation script if Drupal has not been // installed yet (i.e., if no $databases array has been defined in the // settings.php file) and we are not already installing. diff --git a/core/includes/update.inc b/core/includes/update.inc index 45cad22..508e01b 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -11,6 +11,7 @@ use Drupal\Component\Graph\Graph; use Drupal\Core\Config\FileStorage; use Drupal\Core\Config\ConfigException; +use Drupal\Core\DrupalKernel; use Drupal\Component\Uuid\Uuid; use Drupal\Component\Utility\NestedArray; @@ -91,7 +92,20 @@ function update_prepare_d8_bootstrap() { include_once DRUPAL_ROOT . '/core/includes/install.inc'; include_once DRUPAL_ROOT . '/core/includes/schema.inc'; // Bootstrap to configuration. - drupal_bootstrap(DRUPAL_BOOTSTRAP_KERNEL); + drupal_bootstrap(DRUPAL_BOOTSTRAP_CONFIGURATION); + + // During the bootstrap to DRUPAL_BOOTSTRAP_PAGE_CACHE, code will try to read + // the cache but the cache tables are not compatible yet. Use the Null backend + // by default to avoid exceptions. + $GLOBALS['conf']['cache_classes'] = array('cache' => 'Drupal\Core\Cache\NullBackend'); + + // Enable UpdateBundle service overrides. + $GLOBALS['conf']['container_bundles'][] = 'Drupal\Core\DependencyInjection\UpdateBundle'; + + // Bootstrap the kernel. + // Do not attempt to dump and write it. + $kernel = new DrupalKernel('update', FALSE, drupal_classloader(), FALSE); + $kernel->boot(); // Check whether settings.php needs to be rewritten. $settings_exist = !empty($GLOBALS['config_directories']); @@ -135,10 +149,7 @@ function update_prepare_d8_bootstrap() { drupal_install_config_directories(); } - // Bootstrap the database. During this, the DRUPAL_BOOTSTRAP_PAGE_CACHE will - // try to read the cache but the cache tables might not be Drupal 8 - // compatible yet. Use the null backend by default to avoid exceptions. - $GLOBALS['conf']['cache_classes'] = array('cache' => 'Drupal\Core\Cache\NullBackend'); + // Bootstrap the database. drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); // If the site has not updated to Drupal 8 yet, check to make sure that it is diff --git a/core/lib/Drupal/Core/DependencyInjection/UpdateBundle.php b/core/lib/Drupal/Core/DependencyInjection/UpdateBundle.php new file mode 100644 index 0000000..539affd --- /dev/null +++ b/core/lib/Drupal/Core/DependencyInjection/UpdateBundle.php @@ -0,0 +1,37 @@ +register('lock', 'Drupal\Core\Lock\NullLockBackend'); + + // Prevent config from accessing {cache_config}. + // @see $conf['cache_classes'], update_prepare_d8_bootstrap() + $container + ->register('config.storage', 'Drupal\Core\Config\FileStorage') + ->addArgument(config_get_config_directory(CONFIG_ACTIVE_DIRECTORY)); + } + +} diff --git a/core/modules/filter/filter.install b/core/modules/filter/filter.install index 39ef59b..536d4f6 100644 --- a/core/modules/filter/filter.install +++ b/core/modules/filter/filter.install @@ -47,9 +47,6 @@ function filter_update_8001() { // Generate a UUID. $format['uuid'] = $uuid->generate(); - // Add user roles. - $format['roles'] = array_keys(user_roles(FALSE, 'use text format ' . $format['format'])); - // Retrieve and prepare all filters. $filters = db_query('SELECT name, module, status, weight, settings FROM {filter} WHERE format = :format ORDER BY weight, module, name', array( ':format' => $id, diff --git a/core/update.php b/core/update.php index 69f058a..1f7ac5f 100644 --- a/core/update.php +++ b/core/update.php @@ -333,10 +333,15 @@ function update_access_allowed() { // Calls to user_access() might fail during the Drupal 6 to 7 update process, // so we fall back on requiring that the user be logged in as user #1. try { - require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'user') . '/user.module'; + $module_handler = drupal_container()->get('module_handler'); + $module_filenames = $module_handler->getModuleList(); + $module_filenames['user'] = 'core/modules/user/user.module'; + $module_handler->setModuleList($module_filenames); + $module_handler->reload(); + drupal_container()->get('kernel')->updateModules($module_filenames, $module_filenames); return user_access('administer software updates'); } - catch (Exception $e) { + catch (\Exception $e) { return ($user->uid == 1); } }