diff --git a/core/includes/common.inc b/core/includes/common.inc index 5e9ff1c..69b201a 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -2938,7 +2938,7 @@ function drupal_pre_render_styles($elements) { // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the // URL changed. - $query_string = variable_get('css_js_query_string', '0'); + $query_string = state()->get('system.css_js_query_string') ?: '0'; // For inline CSS to validate as XHTML, all CSS containing XHTML needs to be // wrapped in CDATA. To make that backwards compatible with HTML 4, we need to @@ -3969,7 +3969,7 @@ function drupal_pre_render_scripts($elements) { // URL changed. Files that should not be cached (see drupal_add_js()) // get REQUEST_TIME as query-string instead, to enforce reload on every // page request. - $default_query_string = variable_get('css_js_query_string', '0'); + $default_query_string = state()->get('system.css_js_query_string') ?: '0'; // For inline JavaScript to validate as XHTML, all JavaScript containing // XHTML needs to be wrapped in CDATA. To make that backwards compatible @@ -6484,7 +6484,7 @@ function drupal_flush_all_caches() { */ function _drupal_flush_css_js() { // The timestamp is converted to base 36 in order to make it more compact. - variable_set('css_js_query_string', base_convert(REQUEST_TIME, 10, 36)); + state()->set('system.css_js_query_string', base_convert(REQUEST_TIME, 10, 36)); } /** diff --git a/core/includes/install.core.inc b/core/includes/install.core.inc index 803947f..d0958c0 100644 --- a/core/includes/install.core.inc +++ b/core/includes/install.core.inc @@ -367,6 +367,13 @@ function install_begin_request(&$install_state) { )) ->addMethodCall('setUserAgent', array('Drupal (+http://drupal.org/)')); + $container->register('keyvalue', 'Drupal\Core\KeyValueStore\KeyValueFactory') + ->addArgument(new Reference('service_container')); + $container->register('keyvalue.memory', 'Drupal\Core\KeyValueStore\KeyValueMemoryFactory'); + // Override the default keyvalue storage to use memory as the database is + // not available. + $conf['keyvalue_default'] = 'keyvalue.memory'; + drupal_container($container); } @@ -1087,7 +1094,7 @@ function install_database_errors($database, $settings_file) { * @see install_settings_form_validate() */ function install_settings_form_submit($form, &$form_state) { - global $install_state; + global $install_state, $conf; // Update global settings array and save. $settings['databases'] = array( @@ -1104,6 +1111,10 @@ function install_settings_form_submit($form, &$form_state) { // Add the config directories to settings.php. drupal_install_config_directories(); + // The container is about to be rebuilt so we need to unset the keyvalue + // storage override that the installer is using. + unset($conf['keyvalue_default']); + // Indicate that the settings file has been verified, and check the database // for the last completed task, now that we have a valid connection. This // last step is important since we want to trigger an error if the new diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php index 30cf24e..58ecc99 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/CascadingStylesheetsTest.php @@ -77,7 +77,7 @@ function testRenderFile() { $styles = drupal_get_css(); $this->assertTrue(strpos($styles, $css) > 0, 'Rendered CSS includes the added stylesheet.'); // Verify that newlines are properly added inside style tags. - $query_string = variable_get('css_js_query_string', '0'); + $query_string = state()->get('system.css_js_query_string') ?: '0'; $css_processed = ""; $this->assertEqual(trim($styles), $css_processed, 'Rendered CSS includes newlines inside style tags for JavaScript use.'); } @@ -227,7 +227,7 @@ function testAlter() { */ function testAddCssFileWithQueryString() { $this->drupalGet('common-test/query-string'); - $query_string = variable_get('css_js_query_string', '0'); + $query_string = state()->get('system.css_js_query_string') ?: '0'; $this->assertRaw(drupal_get_path('module', 'node') . '/node.admin.css?' . $query_string, 'Query string was appended correctly to css.'); $this->assertRaw(drupal_get_path('module', 'node') . '/node-fake.css?arg1=value1&arg2=value2', 'Query string not escaped on a URI.'); } 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 3c54ad4..b74a4e1 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Common/JavaScriptTest.php @@ -100,7 +100,7 @@ function testAddExternal() { * Tests adding JavaScript files with additional attributes. */ function testAttributes() { - $default_query_string = variable_get('css_js_query_string', '0'); + $default_query_string = state()->get('system.css_js_query_string') ?: '0'; drupal_add_library('system', 'drupal'); drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); @@ -121,7 +121,7 @@ function testAggregatedAttributes() { // Enable aggregation. config('system.performance')->set('js.preprocess', 1)->save(); - $default_query_string = variable_get('css_js_query_string', '0'); + $default_query_string = state()->get('system.css_js_query_string') ?: '0'; drupal_add_library('system', 'drupal'); drupal_add_js('http://example.com/script.js', array('attributes' => array('defer' => 'defer'))); @@ -282,7 +282,7 @@ function testDifferentWeight() { * @see drupal_pre_render_conditional_comments() */ function testBrowserConditionalComments() { - $default_query_string = variable_get('css_js_query_string', '0'); + $default_query_string = state()->get('system.css_js_query_string') ?: '0'; drupal_add_library('system', 'drupal'); drupal_add_js('core/misc/collapse.js', array('browsers' => array('IE' => 'lte IE 8', '!IE' => FALSE))); @@ -311,7 +311,7 @@ function testVersionQueryString() { * Tests JavaScript grouping and aggregation. */ function testAggregation() { - $default_query_string = variable_get('css_js_query_string', '0'); + $default_query_string = state()->get('system.css_js_query_string') ?: '0'; // To optimize aggregation, items with the 'every_page' option are ordered // ahead of ones without. The order of JavaScript execution must be the @@ -554,7 +554,7 @@ function testGetLibrary() { */ function testAddJsFileWithQueryString() { $this->drupalGet('common-test/query-string'); - $query_string = variable_get('css_js_query_string', '0'); + $query_string = state()->get('system.css_js_query_string') ?: '0'; $this->assertRaw(drupal_get_path('module', 'node') . '/node.js?' . $query_string, 'Query string was appended correctly to js.'); } } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index cfc9a4e..f46b45f 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1840,12 +1840,13 @@ function system_update_8031() { } /** - * Removes the drupal_js_cache_files variable. + * Removes the drupal_js_cache_files and css_js_query_string variables. * * @ingroup config_upgrade */ function system_update_8032() { update_variable_del('drupal_js_cache_files'); + update_variable_del('css_js_query_string'); } /** diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 5f540a3..1d4a29a 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -3267,9 +3267,6 @@ function system_settings_form_submit($form, &$form_state) { * * @see system_config_form_submit() * @ingroup forms - * - * @todo Replace this temporary helper with a more sophisticated solution: - * http://drupal.org/node/1324618. */ function system_config_form($form, &$form_state) { $form['actions']['#type'] = 'actions';