diff --git a/core/includes/common.inc b/core/includes/common.inc index 0336161..a002e45 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3644,14 +3644,10 @@ function drupal_prepare_page($page) { // Modules can add elements to $page as needed in hook_page_build(). if (!defined('MAINTENANCE_MODE')) { - $implementations = \Drupal::moduleHandler()->getImplementations('page_build'); - } - else { - $implementations = array('system'); - } - foreach ($implementations as $module) { - $function = $module . '_page_build'; - $function($page); + foreach (\Drupal::moduleHandler()->getImplementations('page_build') as $module) { + $function = $module . '_page_build'; + $function($page); + } } // Modules alter the $page as needed. Blocks are populated into regions like // 'sidebar_first', 'footer', etc. diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 7f494c5..de4069e 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -9,6 +9,7 @@ use Drupal\Core\Database\Database; use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Database\Install\TaskException; +use Drupal\Core\Extension\InfoParser; use Drupal\Core\Installer\Exception\AlreadyInstalledException; use Drupal\Core\Installer\Exception\InstallerException; use Drupal\Core\Installer\Exception\NoProfilesException; @@ -346,27 +347,47 @@ function install_begin_request(&$install_state) { } } + // Add list of all available profiles to the installation state. + $listing = new ExtensionDiscovery(); + $listing->setProfileDirectories(array()); + $install_state['profiles'] += $listing->scan('profile'); + + // Prime drupal_get_filename()'s static cache. + foreach ($install_state['profiles'] as $name => $profile) { + drupal_get_filename('profile', $name, $profile->uri); + } + + $container->set('info_parser', new InfoParser()); + if ($profile = _install_select_profile($install_state)) { + $install_state['parameters']['profile'] = $profile; + install_load_profile($install_state); + if (isset($install_state['profile_info']['distribution']['install']['theme'])) { + $install_state['theme'] = $install_state['profile_info']['distribution']['install']['theme']; + } + } + // Replace services with in-memory and null implementations. This kernel is // replaced with a regular one in drupal_install_system(). if (!$install_state['base_system_verified']) { - $environment = 'install'; $GLOBALS['conf']['container_service_providers']['InstallerServiceProvider'] = 'Drupal\Core\Installer\InstallerServiceProvider'; - - // Various services need a database connection. Supply one. - if (!$install_state['database_verified']) { - Database::addConnectionInfo('install', 'default', array( - 'driver' => 'sqlite', - 'database' => ':memory:', - )); - } + $kernel = new DrupalKernel('install', drupal_classloader(), FALSE); + $module_list['system'] = 'core/modules/system/system.module'; + $kernel->updateModules($module_list, $module_list); } else { - $environment = 'prod'; + $kernel = new DrupalKernel('prod', drupal_classloader(), FALSE); } - - $kernel = new DrupalKernel($environment, drupal_classloader(), FALSE); $kernel->boot(); + // Override the module list with a minimal set of modules. + $module_handler = \Drupal::moduleHandler(); + if ($profile && !$module_handler->moduleExists($profile)) { + $module_list = $module_handler->getModuleList(); + $module_list[$profile] = $install_state['profiles'][$profile]->uri; + $module_handler->setModuleList($module_list); + $kernel->updateModules($module_list, $module_list); + } + // Enter the request scope and add the Request. // @todo Remove this after converting all installer screens into controllers. $container = $kernel->getContainer(); @@ -389,40 +410,7 @@ function install_begin_request(&$install_state) { \Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']); } - // Add list of all available profiles to the installation state. - $listing = new ExtensionDiscovery(); - $listing->setProfileDirectories(array()); - $install_state['profiles'] += $listing->scan('profile'); - - // Prime drupal_get_filename()'s static cache. - foreach ($install_state['profiles'] as $name => $profile) { - drupal_get_filename('profile', $name, $profile->uri); - } - - if ($profile = _install_select_profile($install_state)) { - $install_state['parameters']['profile'] = $profile; - install_load_profile($install_state); - if (isset($install_state['profile_info']['distribution']['install']['theme'])) { - $install_state['theme'] = $install_state['profile_info']['distribution']['install']['theme']; - } - } - - // Override the module list with a minimal set of modules. - $module_handler = \Drupal::moduleHandler(); - $module_list = $module_handler->getModuleList(); - if (!$module_handler->moduleExists('system')) { - $module_list['system'] = 'core/modules/system/system.module'; - system_register('module', 'system', $module_list['system']); - } - if ($profile && !$module_handler->moduleExists($profile)) { - $module_list[$profile] = $install_state['profiles'][$profile]->uri; - system_register('profile', $profile, $module_list[$profile]); - } - $module_handler->setModuleList($module_list); - // After setting up a custom and finite module list in a custom low-level - // bootstrap like here, ensure to use ModuleHandler::loadAll() so that - // ModuleHandler::isLoaded() returns TRUE, since that is a condition being - // checked by other subsystems (e.g., the theme system). + // _theme() requires all modules to be loaded. $module_handler->loadAll(); // Prepare for themed output. We need to run this at the beginning of the diff --git a/core/includes/theme.inc b/core/includes/theme.inc index ab2f37b..d1c13f9 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2085,10 +2085,12 @@ function template_preprocess_page(&$variables) { $variables['logo'] = theme_get_setting('logo.url'); $variables['main_menu'] = theme_get_setting('features.main_menu') ? menu_main_menu() : array(); $variables['secondary_menu'] = theme_get_setting('features.secondary_menu') ? menu_secondary_menu() : array(); - $variables['action_links'] = menu_get_local_actions(); $variables['site_name'] = (theme_get_setting('features.name') ? String::checkPlain($site_config->get('name')) : ''); $variables['site_slogan'] = (theme_get_setting('features.slogan') ? filter_xss_admin($site_config->get('slogan')) : ''); - $variables['tabs'] = menu_local_tabs(); + if (!defined('MAINTENANCE_MODE')) { + $variables['tabs'] = menu_local_tabs(); + $variables['action_links'] = menu_get_local_actions(); + } // Pass the main menu and secondary menu to the template as render arrays. if (!empty($variables['main_menu'])) { @@ -2129,10 +2131,12 @@ function template_preprocess_page(&$variables) { // re-use the cache of an already retrieved menu containing the active link // for the current page. // @see menu_tree_page_data() - $variables['breadcrumb'] = array( - '#theme' => 'breadcrumb', - '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()), - ); + if (!defined('MAINTENANCE_MODE')) { + $variables['breadcrumb'] = array( + '#theme' => 'breadcrumb', + '#breadcrumb' => \Drupal::service('breadcrumb')->build(\Drupal::request()->attributes->all()), + ); + } } /** @@ -2223,7 +2227,6 @@ function template_preprocess_maintenance_page(&$variables) { $page_object = $variables['page']['#page']; $attributes = $page_object->getBodyAttributes(); $classes = $attributes['class']; - $classes[] = 'maintenance-page'; $classes[] = 'in-maintenance'; if (isset($variables['db_is_active']) && !$variables['db_is_active']) { @@ -2231,9 +2234,11 @@ function template_preprocess_maintenance_page(&$variables) { } $attributes['class'] = $classes; + // @see system_page_build() $attached = array( '#attached' => array( 'library' => array( + 'core/normalize', 'system/maintenance', ), ), @@ -2246,16 +2251,11 @@ function template_preprocess_maintenance_page(&$variables) { * * Default template: install-page.html.twig. * - * The variables array generated here is a mirror of - * template_preprocess_page(). This preprocessor will run its course when - * theme_install_page() is invoked. - * * @param array $variables * An associative array containing: * - content - An array of page content. * * @see template_preprocess_maintenance_page() - * */ function template_preprocess_install_page(&$variables) { template_preprocess_maintenance_page($variables); @@ -2263,9 +2263,7 @@ function template_preprocess_install_page(&$variables) { $page_object = $variables['page']['#page']; $attributes = $page_object->getBodyAttributes(); $classes = $attributes['class']; - $classes[] = 'install-page'; - $attributes['class'] = $classes; // Override the site name that is displayed on the page, since Drupal is diff --git a/core/lib/Drupal/Core/Installer/InstallerServiceProvider.php b/core/lib/Drupal/Core/Installer/InstallerServiceProvider.php index 26b1d7d..c96d287 100644 --- a/core/lib/Drupal/Core/Installer/InstallerServiceProvider.php +++ b/core/lib/Drupal/Core/Installer/InstallerServiceProvider.php @@ -67,8 +67,6 @@ public function alter(ContainerBuilder $container) { // throws an exception upon trying to load a non-existing file. $container->get('config.factory')->setOverrideState(FALSE); - $container->set('database', Database::getConnection('default', 'install')); - // No service may persist when the early installer kernel is rebooted into // the production environment. // @todo The DrupalKernel reboot performed by drupal_install_system() is