diff --git a/core/includes/common.inc b/core/includes/common.inc index a002e45..9aa2b84 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -3658,11 +3658,11 @@ function drupal_prepare_page($page) { // cache, even though they should be. This happens because they're rendered // directly by the theme system. // @todo Remove this once https://drupal.org/node/1869476 lands. - if (theme_get_setting('features.main_menu') && count(menu_main_menu())) { + if (!defined('MAINTENANCE_MODE') && theme_get_setting('features.main_menu') && count(menu_main_menu())) { $main_links_source = _menu_get_links_source('main_links', 'main'); $page['page_top']['#cache']['tags']['menu'][$main_links_source] = $main_links_source; } - if (theme_get_setting('features.secondary_menu') && count(menu_secondary_menu())) { + if (!defined('MAINTENANCE_MODE') && theme_get_setting('features.secondary_menu') && count(menu_secondary_menu())) { $secondary_links_source = _menu_get_links_source('secondary_links', 'account'); $page['page_top']['#cache']['tags']['menu'][$secondary_links_source] = $secondary_links_source; } diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index de4069e..a97387c 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -9,7 +9,6 @@ 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; @@ -301,7 +300,6 @@ function install_begin_request(&$install_state) { require_once __DIR__ . '/form.inc'; require_once __DIR__ . '/batch.inc'; require_once __DIR__ . '/ajax.inc'; - require_once __DIR__ . '/menu.inc'; // Load module basics (needed for hook invokes). include_once __DIR__ . '/module.inc'; @@ -347,46 +345,18 @@ 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'; - $kernel = new DrupalKernel('install', drupal_classloader(), FALSE); - $module_list['system'] = 'core/modules/system/system.module'; - $kernel->updateModules($module_list, $module_list); } else { - $kernel = new DrupalKernel('prod', drupal_classloader(), FALSE); + $environment = 'prod'; } - $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); - } + $kernel = new DrupalKernel($environment, drupal_classloader(), FALSE); + $kernel->boot(); // Enter the request scope and add the Request. // @todo Remove this after converting all installer screens into controllers. @@ -410,7 +380,38 @@ function install_begin_request(&$install_state) { \Drupal::translation()->setDefaultLangcode($install_state['parameters']['langcode']); } - // _theme() requires all modules to be loaded. + // 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'; + } + if ($profile && !$module_handler->moduleExists($profile)) { + $module_list[$profile] = $install_state['profiles'][$profile]->uri; + } + $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). $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 d1c13f9..fe511c7 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -2079,17 +2079,25 @@ function template_preprocess_page(&$variables) { $variables['base_path'] = base_path(); $variables['front_page'] = url(); - $variables['feed_icons'] = drupal_get_feeds(); $variables['language'] = $language_interface; $variables['language']->dir = $language_interface->direction ? 'rtl' : 'ltr'; $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['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')) : ''); + if (!defined('MAINTENANCE_MODE')) { - $variables['tabs'] = menu_local_tabs(); - $variables['action_links'] = menu_get_local_actions(); + $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['tabs'] = menu_local_tabs(); + $variables['action_links'] = menu_get_local_actions(); + $variables['feed_icons'] = drupal_get_feeds(); + } + else { + $variables['main_menu'] = array(); + $variables['secondary_menu'] = array(); + $variables['tabs'] = array(); + $variables['action_links'] = array(); + $variables['feed_icons'] = ''; } // Pass the main menu and secondary menu to the template as render arrays.