diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 4ebe881..aa92150 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2313,7 +2313,7 @@ function _drupal_bootstrap_page_cache() { require_once DRUPAL_ROOT . '/' . $include; } // Check for a cache mode force from settings.php. - if (variable_get('page_cache_without_database')) { + if (config('system.performance')->get('cache.page.without_database')) { $cache_enabled = TRUE; } else { @@ -2338,13 +2338,13 @@ function _drupal_bootstrap_page_cache() { date_default_timezone_set(drupal_get_user_timezone()); // If the skipping of the bootstrap hooks is not enforced, call // hook_boot. - if (variable_get('page_cache_invoke_hooks', TRUE)) { + if (config('system.performance')->get('cache.page.invoke_hooks')) { bootstrap_invoke_all('boot'); } drupal_serve_page_from_cache($cache); // If the skipping of the bootstrap hooks is not enforced, call // hook_exit. - if (variable_get('page_cache_invoke_hooks', TRUE)) { + if (config('system.performance')->get('cache.page.invoke_hooks')) { bootstrap_invoke_all('exit'); } // We are done. diff --git a/core/modules/statistics/statistics.module b/core/modules/statistics/statistics.module index a359981..87ecfc2 100644 --- a/core/modules/statistics/statistics.module +++ b/core/modules/statistics/statistics.module @@ -51,11 +51,12 @@ function statistics_help($path, $arg) { function statistics_exit() { global $user; - // When serving cached pages with the 'page_cache_without_database' - // configuration, system variables need to be loaded. This is a major - // performance decrease for non-database page caches, but with Statistics - // module, it is likely to also have 'statistics.settings:access_log.enabled' - // enabled, in which case we need to bootstrap to the session phase anyway. + // When serving cached pages with the + // 'system.performace:cache.page.without_database' configuration, system + // variables need to be loaded. This is a major performance decrease for + // non-database page caches, but with Statistics module, it is likely to also + // have 'statistics.settings:access_log.enabled' enabled, in which case we + // need to bootstrap to the session phase anyway. drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); if (config('statistics.settings')->get('access_log.enabled')) { diff --git a/core/modules/system/config/system.performance.yml b/core/modules/system/config/system.performance.yml index efd50f1..c519191 100644 --- a/core/modules/system/config/system.performance.yml +++ b/core/modules/system/config/system.performance.yml @@ -1,7 +1,9 @@ cache: page: enabled: '0' + invoke_hooks: '1' max_age: '0' + without_database: '' css: preprocess: '0' gzip: '1' diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php index e9eff7a..526e977 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php @@ -52,7 +52,7 @@ function testHookBootExit() { $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, 'hook_exit called with normal cache.'); // Boot and exit should not fire since the page is cached. - variable_set('page_cache_invoke_hooks', FALSE); + config('system.performance')->set('cache.page.invoke_hooks', '0')->save(); $this->assertTrue(cache('page')->get(url('', array('absolute' => TRUE))), 'Page has been cached.'); $this->drupalGet(''); $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, 'hook_boot not called with aggressive cache and a cached page.');