From 5575b36cf6af1a4c1d5d664843d2d88fdf46c6c9 Mon Sep 17 00:00:00 2001 From: Bram Goffings Date: Sat, 28 Jul 2012 11:40:49 +0200 Subject: [PATCH] changed system performance names --- core/includes/bootstrap.inc | 8 ++++---- core/includes/common.inc | 6 +++--- core/includes/form.inc | 2 +- .../EventSubscriber/RequestCloseSubscriber.php | 2 +- .../color/lib/Drupal/color/Tests/ColorTest.php | 4 ++-- .../lib/Drupal/config/Tests/ConfOverrideTest.php | 4 ++-- .../poll/Tests/PollVoteCheckHostnameTest.php | 2 +- .../statistics/Tests/StatisticsLoggingTest.php | 2 +- core/modules/system/config/system.performance.yml | 14 +++++++++----- .../system/Tests/Bootstrap/HookBootExitTest.php | 4 ++-- .../system/Tests/Bootstrap/PageCacheTest.php | 6 +++--- .../Drupal/system/Tests/Common/JavaScriptTest.php | 10 +++++----- .../Drupal/system/Tests/Session/SessionTest.php | 2 +- .../lib/Drupal/system/Tests/Theme/ThemeTest.php | 6 +++--- core/modules/system/system.admin.inc | 22 +++++++++++----------- 15 files changed, 49 insertions(+), 45 deletions(-) diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index b667d89..cf517f2 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -1294,7 +1294,7 @@ function drupal_serve_page_from_cache(stdClass $cache) { $config = config('system.performance'); // Negotiate whether to use compression. - $page_compression = $config->get('page_compression') && extension_loaded('zlib'); + $page_compression = $config->get('response.gzip') && extension_loaded('zlib'); $return_compressed = $page_compression && isset($_SERVER['HTTP_ACCEPT_ENCODING']) && strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== FALSE; // Get headers set in hook_boot(). Keys are lower-case. @@ -1320,7 +1320,7 @@ function drupal_serve_page_from_cache(stdClass $cache) { // max-age > 0, allowing the page to be cached by external proxies, when a // session cookie is present unless the Vary header has been replaced or // unset in hook_boot(). - $max_age = !isset($_COOKIE[session_name()]) || isset($hook_boot_headers['vary']) ? $config->get('page_cache_maximum_age') : 0; + $max_age = !isset($_COOKIE[session_name()]) || isset($hook_boot_headers['vary']) ? $config->get('cache.page.max_age') : 0; $default_headers['Cache-Control'] = 'public, max-age=' . $max_age; // Entity tag should change if the output changes. @@ -2324,7 +2324,7 @@ function _drupal_bootstrap_page_cache() { else { drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); $config = config('system.performance'); - $cache_enabled = $config->get('cache'); + $cache_enabled = $config->get('cache.page.enabled'); } drupal_block_denied(ip_address()); // If there is no session cookie and cache is enabled (or forced), try @@ -2459,7 +2459,7 @@ function drupal_get_bootstrap_phase() { * @code * // Register the LANGUAGE_TYPE_INTERFACE definition. Registered definitions * // do not necessarily need to be named by a constant. - * // See + * // See * // http://symfony.com/doc/current/components/dependency_injection/introduction.html * // for usage examples of adding object initialization code after register(). * $container = drupal_container(); diff --git a/core/includes/common.inc b/core/includes/common.inc index f2a4003..6b3a4a1 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2937,7 +2937,7 @@ function drupal_aggregate_css(&$css_groups) { } else { $config = config('system.performance'); - $preprocess_css = $config->get('preprocess_css'); + $preprocess_css = $config->get('preprocess.css'); } // For each group that needs aggregation, aggregate its items. @@ -4208,7 +4208,7 @@ function drupal_aggregate_js(&$js_groups) { } else { $config = config('system.performance'); - $preprocess_js = $config->get('preprocess_js'); + $preprocess_js = $config->get('preprocess.js'); } if ($preprocess_js) { @@ -4994,7 +4994,7 @@ function drupal_page_set_cache() { } if ($cache->data['body']) { - if (config('system.performance')->get('page_compression') && extension_loaded('zlib')) { + if (config('system.performance')->get('response.gzip') && extension_loaded('zlib')) { $cache->data['body'] = gzencode($cache->data['body'], 9, FORCE_GZIP); } cache('page')->set($cache->cid, $cache->data, $cache->expire, $cache->tags); diff --git a/core/includes/form.inc b/core/includes/form.inc index 6a747b6..490bc15 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -873,7 +873,7 @@ function drupal_process_form($form_id, &$form, &$form_state) { // here, as we've finished with them. The in-memory copies are still // here, though. $config = config('system.performance'); - if (!$config->get('cache') && !empty($form_state['values']['form_build_id'])) { + if (!$config->get('cache.page.enabled') && !empty($form_state['values']['form_build_id'])) { cache('form')->delete('form_' . $form_state['values']['form_build_id']); cache('form')->delete('form_state_' . $form_state['values']['form_build_id']); } diff --git a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php index bae06fe..27e2729 100644 --- a/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php +++ b/core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php @@ -37,7 +37,7 @@ class RequestCloseSubscriber implements EventSubscriberInterface { $response = $event->getResponse(); $config = config('system.performance'); - if ($config->get('cache') && ($cache = drupal_page_set_cache())) { + if ($config->get('cache.page.enabled') && ($cache = drupal_page_set_cache())) { drupal_serve_page_from_cache($cache); } else { diff --git a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php index 3bc95d3..1f72497 100644 --- a/core/modules/color/lib/Drupal/color/Tests/ColorTest.php +++ b/core/modules/color/lib/Drupal/color/Tests/ColorTest.php @@ -97,7 +97,7 @@ class ColorTest extends WebTestBase { // Test with aggregated CSS turned on. $config = config('system.performance'); - $config->set('preprocess_css', 1); + $config->set('preprocess.css', 1); $config->save(); $this->drupalGet(''); $stylesheets = variable_get('drupal_css_cache_files', array()); @@ -106,7 +106,7 @@ class ColorTest extends WebTestBase { $stylesheet_content .= join("\n", file(drupal_realpath($uri))); } $this->assertTrue(strpos($stylesheet_content, 'public://') === FALSE, 'Make sure the color paths have been translated to local paths. (' . $theme . ')'); - $config->set('preprocess_css', 0); + $config->set('preprocess.css', 0); $config->save(); } diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfOverrideTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfOverrideTest.php index 104af8e..57c1a14 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfOverrideTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfOverrideTest.php @@ -29,10 +29,10 @@ class ConfOverrideTest extends WebTestBase { function testConfigurationOverride() { global $conf; $config = config('system.performance'); - $this->assertNotEqual($config->get('cache'), $this->testContent); + $this->assertNotEqual($config->get('cache.page.enabled'), $this->testContent); $conf['system.performance']['cache'] = $this->testContent; $config = config('system.performance'); - $this->assertEqual($config->get('cache'), $conf['system.performance']['cache']); + $this->assertEqual($config->get('cache.page.enabled'), $conf['system.performance']['cache']); } } diff --git a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php index 9357331..61e83c0 100644 --- a/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php +++ b/core/modules/poll/lib/Drupal/poll/Tests/PollVoteCheckHostnameTest.php @@ -33,7 +33,7 @@ class PollVoteCheckHostnameTest extends PollTestBase { // Enable page cache to verify that the result page is not saved in the // cache when anonymous voting is allowed. $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); // Create poll. diff --git a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php index d895564..121ccd7 100644 --- a/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php +++ b/core/modules/statistics/lib/Drupal/statistics/Tests/StatisticsLoggingTest.php @@ -40,7 +40,7 @@ class StatisticsLoggingTest extends WebTestBase { // Enable page caching. $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); // Enable access logging. diff --git a/core/modules/system/config/system.performance.yml b/core/modules/system/config/system.performance.yml index bb02952..fef3efe 100644 --- a/core/modules/system/config/system.performance.yml +++ b/core/modules/system/config/system.performance.yml @@ -1,5 +1,9 @@ -cache: '0' -page_cache_maximum_age: '0' -page_compression: '0' -preprocess_css: '0' -preprocess_js: '0' +cache: + page: + enabled: '0' + max_age: '0' +response: + gzip: '0' +preprocess: + css: '0' + js: '0' 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 0c1f840..b359b05 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/HookBootExitTest.php @@ -32,7 +32,7 @@ class HookBootExitTest extends WebTestBase { function testHookBootExit() { // Test with cache disabled. Boot and exit should always fire. $config = config('system.performance'); - $config->set('cache', 0); + $config->set('cache.page.enabled', 0); $config->save(); $this->drupalGet(''); @@ -41,7 +41,7 @@ class HookBootExitTest extends WebTestBase { $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_exit'))->fetchField(), $calls, t('hook_exit called with disabled cache.')); // Test with normal cache. Boot and exit should be called. - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); $this->drupalGet(''); $calls++; diff --git a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php index af6bf6c..a1d3f90 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Bootstrap/PageCacheTest.php @@ -36,7 +36,7 @@ class PageCacheTest extends WebTestBase { */ function testConditionalRequests() { $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); // Fill the cache. @@ -76,7 +76,7 @@ class PageCacheTest extends WebTestBase { */ function testPageCache() { $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); // Fill the cache. @@ -122,7 +122,7 @@ class PageCacheTest extends WebTestBase { */ function testPageCompression() { $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); // Fill the cache and verify that output is compressed. diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php index ea1a749..d90afed 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php @@ -32,8 +32,8 @@ class JavaScriptTest extends WebTestBase { // Disable preprocessing $config = config('system.performance'); - $this->preprocess_js = $config->get('preprocess_js'); - $config->set('preprocess_js', 0); + $this->preprocess_js = $config->get('preprocess.js'); + $config->set('preprocess.js', 0); $config->save(); // Reset drupal_add_js() and drupal_add_library() statics before each test. @@ -44,7 +44,7 @@ class JavaScriptTest extends WebTestBase { function tearDown() { // Restore configured value for JavaScript preprocessing. $config = config('system.performance'); - $config->set('preprocess_js', $this->preprocess_js); + $config->set('preprocess.js', $this->preprocess_js); $config->save(); parent::tearDown(); } @@ -279,7 +279,7 @@ class JavaScriptTest extends WebTestBase { // 'every_page' files, and one file is made for the others. drupal_static_reset('drupal_add_js'); $config = config('system.performance'); - $config->set('preprocess_js', 1); + $config->set('preprocess.js', 1); $config->save(); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/collapse.js', array('every_page' => TRUE)); @@ -299,7 +299,7 @@ class JavaScriptTest extends WebTestBase { */ function testAggregationOrder() { // Enable JavaScript aggregation. - config('system.performance')->set('preprocess_js', 1)->save(); + config('system.performance')->set('preprocess.js', 1)->save(); drupal_static_reset('drupal_add_js'); // Add two JavaScript files to the current request and build the cache. diff --git a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php index 02cb8ae..5d11a3b 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Session/SessionTest.php @@ -144,7 +144,7 @@ class SessionTest extends WebTestBase { // The same behavior is expected when caching is enabled. $config = config('system.performance'); - $config->set('cache', 1); + $config->set('cache.page.enabled', 1); $config->save(); $this->drupalGet(''); $this->assertSessionCookie(FALSE); diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php index 4be9dd5..98cb42f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/ThemeTest.php @@ -104,7 +104,7 @@ class ThemeTest extends WebTestBase { // so it doesn't matter what page we get, as long as it is themed with the // test theme. First we test with CSS aggregation disabled. $config = config('system.performance'); - $config->set('preprocess_css', 0); + $config->set('preprocess.css', 0); $config->save(); $this->drupalGet('theme-test/suggestion'); $this->assertNoText('system.base.css', t('The theme\'s .info file is able to override a module CSS file from being added to the page.')); @@ -113,10 +113,10 @@ class ThemeTest extends WebTestBase { // triggered during drupal_build_css_cache() when a source file doesn't // exist. Then allow remaining tests to continue with aggregation disabled // by default. - $config->set('preprocess_css', 1); + $config->set('preprocess.css', 1); $config->save(); $this->drupalGet('theme-test/suggestion'); - $config->set('preprocess_css', 0); + $config->set('preprocess.css', 0); $config->save(); } diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index d956f05..456cc73 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1694,7 +1694,7 @@ function system_performance_settings($form, &$form_state) { $form['caching']['cache'] = array( '#type' => 'checkbox', '#title' => t('Cache pages for anonymous users'), - '#default_value' => $config->get('cache'), + '#default_value' => $config->get('cache.page.enabled'), '#weight' => -2, ); @@ -1703,7 +1703,7 @@ function system_performance_settings($form, &$form_state) { $form['caching']['page_cache_maximum_age'] = array( '#type' => 'select', '#title' => t('Expiration of cached pages'), - '#default_value' => $config->get('page_cache_maximum_age'), + '#default_value' => $config->get('cache.page.max_age'), '#options' => $period, '#description' => t('The maximum time an external cache can use an old version of a page.'), ); @@ -1722,24 +1722,24 @@ function system_performance_settings($form, &$form_state) { '#description' => t('External resources can be optimized automatically, which can reduce both the size and number of requests made to your website.') . $disabled_message, ); - $js_hide = $config->get('cache') ? '' : ' class="js-hide"'; + $js_hide = $config->get('cache.page.enabled') ? '' : ' class="js-hide"'; $form['bandwidth_optimization']['page_compression'] = array( '#type' => 'checkbox', '#title' => t('Compress cached pages.'), - '#default_value' => $config->get('page_compression'), + '#default_value' => $config->get('response.gzip'), '#prefix' => '
', '#suffix' => '
', ); $form['bandwidth_optimization']['preprocess_css'] = array( '#type' => 'checkbox', '#title' => t('Aggregate and compress CSS files.'), - '#default_value' => $config->get('preprocess_css'), + '#default_value' => $config->get('preprocess.css'), '#disabled' => $disabled, ); $form['bandwidth_optimization']['preprocess_js'] = array( '#type' => 'checkbox', '#title' => t('Aggregate JavaScript files.'), - '#default_value' => $config->get('preprocess_js'), + '#default_value' => $config->get('preprocess.js'), '#disabled' => $disabled, ); @@ -1760,11 +1760,11 @@ function system_performance_settings($form, &$form_state) { */ function system_performance_settings_submit($form, &$form_state) { $config = config('system.performance'); - $config->set('cache', $form_state['values']['cache']); - $config->set('page_cache_maximum_age', $form_state['values']['page_cache_maximum_age']); - $config->set('page_compression', $form_state['values']['page_compression']); - $config->set('preprocess_css', $form_state['values']['preprocess_css']); - $config->set('preprocess_js', $form_state['values']['preprocess_js']); + $config->set('cache.page.enabled', $form_state['values']['cache']); + $config->set('cache.page.max_age', $form_state['values']['page_cache_maximum_age']); + $config->set('response.gzip', $form_state['values']['page_compression']); + $config->set('preprocess.css', $form_state['values']['preprocess_css']); + $config->set('preprocess.js', $form_state['values']['preprocess_js']); $config->save(); } -- 1.7.11.msysgit.1