diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 1a06544..afe2bda 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2340,8 +2340,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('system.performance')->get('cache'); } drupal_block_denied(ip_address()); // If there is no session cookie and cache is enabled (or forced), try diff --git a/core/includes/common.inc b/core/includes/common.inc index 3a79f0e..bc748a9 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2597,8 +2597,7 @@ function drupal_page_footer() { // Commit the user session, if needed. drupal_session_commit(); - $config = config('system.performance'); - if ($config->get('cache') && ($cache = drupal_page_set_cache())) { + if (config('system.performance')->get('cache') && ($cache = drupal_page_set_cache())) { drupal_serve_page_from_cache($cache); } else { diff --git a/core/includes/form.inc b/core/includes/form.inc index 1c3841f..9390e2b 100644 --- a/core/includes/form.inc +++ b/core/includes/form.inc @@ -856,8 +856,7 @@ function drupal_process_form($form_id, &$form, &$form_state) { // We'll clear out the cached copies of the form and its stored data // 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('system.performance')->get('cache') && !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/includes/install.core.inc b/core/includes/install.core.inc index f0b969f..a814e84 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -1012,8 +1012,7 @@ function install_settings_form_submit($form, &$form_state) { // How best to handle errors here? }; - // Write out a .htaccess file that will protect the config directory from - // prying eyes. + // Add a .htaccess file to protect the config directory from prying eyes. file_save_htaccess($config_path, TRUE); // Indicate that the settings file has been verified, and check the database diff --git a/core/includes/language.inc b/core/includes/language.inc index d1cc818..94848c2 100644 --- a/core/includes/language.inc +++ b/core/includes/language.inc @@ -343,8 +343,7 @@ function language_provider_invoke($provider_id, $provider = NULL) { // If the language provider has no cache preference or this is satisfied // we can execute the callback. - $config = config('system.performance'); - $cache = !isset($provider['cache']) || $user->uid || $provider['cache'] == $config->get('cache'); + $cache = !isset($provider['cache']) || $user->uid || $provider['cache'] == config('system.performance')->get('cache'); $callback = isset($provider['callbacks']['language']) ? $provider['callbacks']['language'] : FALSE; $langcode = $cache && function_exists($callback) ? $callback($languages) : FALSE; $results[$provider_id] = isset($languages[$langcode]) ? $languages[$langcode] : FALSE; diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index 7afd698..b2a4d6a 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -101,8 +101,7 @@ class DatabaseBackend implements CacheBackendInterface { // timer. The cache variable is loaded into the $user object by // _drupal_session_read() in session.inc. If the data is permanent or we're // not enforcing a minimum cache lifetime always return the cached data. - $config = config('system.performance'); - if ($cache->expire != CACHE_PERMANENT && $config->get('cache_lifetime') && $user->cache > $cache->created) { + if ($cache->expire != CACHE_PERMANENT && config('system.performance')->get('cache_lifetime') && $user->cache > $cache->created) { // This cache data is too old and thus not valid for us, ignore it. return FALSE; } diff --git a/core/lib/Drupal/Core/Config/DrupalConfig.php b/core/lib/Drupal/Core/Config/DrupalConfig.php index eb4757f..44d009c 100644 --- a/core/lib/Drupal/Core/Config/DrupalConfig.php +++ b/core/lib/Drupal/Core/Config/DrupalConfig.php @@ -123,6 +123,7 @@ class DrupalConfig { else { drupal_array_set_nested_value($this->data, $parts, $value); } + return $this; } public function castValue($value) { diff --git a/core/modules/color/color.test b/core/modules/color/color.test index 616d19a..0398f26 100644 --- a/core/modules/color/color.test +++ b/core/modules/color/color.test @@ -93,8 +93,7 @@ class ColorTestCase extends DrupalWebTestCase { // Test with aggregated CSS turned on. $config = config('system.performance'); - $config->set('preprocess_css', 1); - $config->save(); + $config->set('preprocess_css', 1)->save(); $this->drupalGet(''); $stylesheets = variable_get('drupal_css_cache_files', array()); $stylesheet_content = ''; @@ -102,8 +101,7 @@ class ColorTestCase extends DrupalWebTestCase { $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->save(); + $config->set('preprocess_css', 0)->save(); } /** diff --git a/core/modules/config/config.test b/core/modules/config/config.test index d97eff1..ccbf4ad 100644 --- a/core/modules/config/config.test +++ b/core/modules/config/config.test @@ -147,11 +147,12 @@ class ConfigFileContentTestCase extends DrupalWebTestCase { $this->assertIdentical($db_config, FALSE); $this->assertFalse(file_exists($config_dir . '/' . $name . '.' . $this->fileExtension)); + // Chainable ->set()->save() // Attempt to delete non-existing configuration. // Write and read an array value. // Add an array value to a nested key. - // Type casting into string. + // Type casting into string. (recursively) // NULL value behavior. - // List config names by prefix. + // List config names by prefix. (and without prefix) } } diff --git a/core/modules/poll/poll.test b/core/modules/poll/poll.test index adec664..c0a51d2 100644 --- a/core/modules/poll/poll.test +++ b/core/modules/poll/poll.test @@ -496,9 +496,7 @@ class PollVoteCheckHostname extends PollTestCase { // 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->save(); + config('system.performance')->set('cache', 1)->save(); // Create poll. $title = $this->randomName(); diff --git a/core/modules/simpletest/tests/bootstrap.test b/core/modules/simpletest/tests/bootstrap.test index fee8fcc..9d74434 100644 --- a/core/modules/simpletest/tests/bootstrap.test +++ b/core/modules/simpletest/tests/bootstrap.test @@ -116,9 +116,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { * Test support for requests containing If-Modified-Since and If-None-Match headers. */ function testConditionalRequests() { - $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + config('system.performance')->set('cache', 1)->save(); // Fill the cache. $this->drupalGet(''); @@ -156,9 +154,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { * Test cache headers. */ function testPageCache() { - $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + config('system.performance')->set('cache', 1)->save(); // Fill the cache. $this->drupalGet('system-test/set-header', array('query' => array('name' => 'Foo', 'value' => 'bar'))); @@ -202,9 +198,7 @@ class BootstrapPageCacheTestCase extends DrupalWebTestCase { * mod_deflate Apache module. */ function testPageCompression() { - $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + config('system.performance')->set('cache', 1)->save(); // Fill the cache and verify that output is compressed. $this->drupalGet('', array(), array('Accept-Encoding: gzip,deflate')); @@ -298,17 +292,14 @@ class HookBootExitTestCase extends DrupalWebTestCase { function testHookBootExit() { // Test with cache disabled. Boot and exit should always fire. $config = config('system.performance'); - $config->set('cache', 0); - $config->save(); - + $config->set('cache', 0)->save(); $this->drupalGet(''); $calls = 1; $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with disabled cache.')); $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->save(); + $config->set('cache', 1)->save(); $this->drupalGet(''); $calls++; $this->assertEqual(db_query('SELECT COUNT(*) FROM {watchdog} WHERE type = :type AND message = :message', array(':type' => 'system_test', ':message' => 'hook_boot'))->fetchField(), $calls, t('hook_boot called with normal cache.')); diff --git a/core/modules/simpletest/tests/cache.test b/core/modules/simpletest/tests/cache.test index 81f2377..b9fdf8d 100644 --- a/core/modules/simpletest/tests/cache.test +++ b/core/modules/simpletest/tests/cache.test @@ -95,9 +95,7 @@ class CacheTestCase extends DrupalWebTestCase { * The time in seconds the cache should minimal live. */ protected function setupLifetime($time) { - $config = config('system.performance'); - $config->set('cache_lifetime', $time); - $config->save(); + config('system.performance')->set('cache_lifetime', $time)->save(); variable_set('cache_flush', 0); } } diff --git a/core/modules/simpletest/tests/common.test b/core/modules/simpletest/tests/common.test index a681cf1..d6ec223 100644 --- a/core/modules/simpletest/tests/common.test +++ b/core/modules/simpletest/tests/common.test @@ -1173,8 +1173,7 @@ class CommonJavaScriptTestCase extends DrupalWebTestCase { // Disable preprocessing $config = config('system.performance'); $this->preprocess_js = $config->get('preprocess_js'); - $config->set('preprocess_js', 0); - $config->save(); + $config->set('preprocess_js', 0)->save(); // Reset drupal_add_js() and drupal_add_library() statics before each test. drupal_static_reset('drupal_add_js'); @@ -1184,8 +1183,7 @@ class CommonJavaScriptTestCase extends DrupalWebTestCase { function tearDown() { // Restore configured value for JavaScript preprocessing. $config = config('system.performance'); - $config->set('preprocess_js', $this->preprocess_js); - $config->save(); + $config->set('preprocess_js', $this->preprocess_js)->save(); parent::tearDown(); } @@ -1383,9 +1381,7 @@ class CommonJavaScriptTestCase extends DrupalWebTestCase { // Now ensure that with aggregation on, one file is made for the // '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->save(); + config('system.performance')->set('preprocess_js', 1)->save(); drupal_add_js('core/misc/ajax.js'); drupal_add_js('core/misc/authorize.js', array('every_page' => TRUE)); drupal_add_js('core/misc/autocomplete.js'); diff --git a/core/modules/simpletest/tests/session.test b/core/modules/simpletest/tests/session.test index 6303ca5..e5cfbff 100644 --- a/core/modules/simpletest/tests/session.test +++ b/core/modules/simpletest/tests/session.test @@ -139,9 +139,7 @@ class SessionTestCase extends DrupalWebTestCase { $this->assertSessionEmpty(TRUE); // The same behavior is expected when caching is enabled. - $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + config('system.performance')->set('cache', 1)->save(); $this->drupalGet(''); $this->assertSessionCookie(FALSE); $this->assertSessionEmpty(TRUE); diff --git a/core/modules/simpletest/tests/theme.test b/core/modules/simpletest/tests/theme.test index 0ed109d..d830106 100644 --- a/core/modules/simpletest/tests/theme.test +++ b/core/modules/simpletest/tests/theme.test @@ -93,8 +93,7 @@ class ThemeUnitTest extends DrupalWebTestCase { // 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->save(); + $config->set('preprocess_css', 0)->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.')); @@ -102,11 +101,9 @@ class ThemeUnitTest extends DrupalWebTestCase { // 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->save(); + $config->set('preprocess_css', 1)->save(); $this->drupalGet('theme-test/suggestion'); - $config->set('preprocess_css', 0); - $config->save(); + $config->set('preprocess_css', 0)->save(); } /** diff --git a/core/modules/statistics/statistics.test b/core/modules/statistics/statistics.test index 7fac22c..ae4b6ed 100644 --- a/core/modules/statistics/statistics.test +++ b/core/modules/statistics/statistics.test @@ -69,9 +69,7 @@ class StatisticsLoggingTestCase extends DrupalWebTestCase { $this->node = $this->drupalCreateNode(array('title' => $this->randomName(255), 'uid' => $this->auth_user->uid)); // Enable page caching. - $config = config('system.performance'); - $config->set('cache', 1); - $config->save(); + config('system.performance')->set('cache', TRUE)->save(); // Enable access logging. variable_set('statistics_enable_access_log', 1); diff --git a/core/modules/system/system.admin.inc b/core/modules/system/system.admin.inc index abe1577..1cbbe10 100644 --- a/core/modules/system/system.admin.inc +++ b/core/modules/system/system.admin.inc @@ -1652,14 +1652,14 @@ function system_performance_settings($form, &$form_state) { '#title' => t('Minimum cache lifetime'), '#default_value' => $config->get('cache_lifetime'), '#options' => $period, - '#description' => t('Cached pages will not be re-created until at least this much time has elapsed.'), + '#description' => t('Cached pages will not be re-created until at least this much time has elapsed.') ); $form['caching']['page_cache_maximum_age'] = array( '#type' => 'select', '#title' => t('Expiration of cached pages'), '#default_value' => $config->get('page_cache_maximum_age'), '#options' => $period, - '#description' => t('The maximum time an external cache can use an old version of a page.'), + '#description' => t('The maximum time an external cache can use an old version of a page.') ); $directory = 'public://'; @@ -1703,12 +1703,12 @@ function system_performance_settings($form, &$form_state) { '#value' => t('Save configuration'), ); + $form['#submit'][] = 'system_performance_settings_submit'; $form['#submit'][] = 'drupal_clear_css_cache'; $form['#submit'][] = 'drupal_clear_js_cache'; // This form allows page compression settings to be changed, which can // invalidate the page cache, so it needs to be cleared on form submit. $form['#submit'][] = 'system_clear_page_cache_submit'; - $form['#submit'][] = 'system_performance_settings_submit'; return $form; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 8c34a1d..e98a4fd 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -716,7 +716,6 @@ function system_schema() { 'primary key' => array('name'), ); - $schema['date_format_type'] = array( 'description' => 'Stores configured date format types.', 'fields' => array(