diff --git a/core/includes/common.inc b/core/includes/common.inc index aea8529..0681338 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4773,7 +4773,7 @@ function drupal_build_js_cache($files) { * Deletes old cached JavaScript files and variables. */ function drupal_clear_js_cache() { - variable_del('javascript_parsed'); + state()->delete('javascript_parsed'); variable_del('drupal_js_cache_files'); file_scan_directory('public://js', '/.*/', array('callback' => 'drupal_delete_file_if_stale')); } diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php index 7591f67..4a20e46 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleUninstallTest.php @@ -130,7 +130,7 @@ class LocaleUninstallTest extends WebTestBase { $this->assertFalse(variable_get('language_negotiation_session_param', FALSE), t('Visit language negotiation method settings cleared.')); // Check JavaScript parsed. - $javascript_parsed_count = count(variable_get('javascript_parsed', array())); + $javascript_parsed_count = count(state()->get('javascript_parsed') ?: array()); $this->assertEqual($javascript_parsed_count, 0, t('JavaScript parsed count: %count', array('%count' => $javascript_parsed_count))); // Check JavaScript translations directory. diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 4970242..a3ce756 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -28,7 +28,7 @@ function locale_uninstall() { // Clear variables. variable_del('locale_cache_strings'); variable_del('locale_js_directory'); - variable_del('javascript_parsed'); + state()->delete('javascript_parsed'); variable_del('locale_cache_length'); variable_del('locale_translation_plurals'); variable_del('locale_translation_javascript'); diff --git a/core/modules/locale/locale.module b/core/modules/locale/locale.module index a32d47d..de9948f 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -403,7 +403,7 @@ function locale_js_alter(&$javascript) { $language_interface = language(LANGUAGE_TYPE_INTERFACE); $dir = 'public://' . variable_get('locale_js_directory', 'languages'); - $parsed = variable_get('javascript_parsed', array()); + $parsed = state()->get('javascript_parsed') ?: array(); $files = $new_files = FALSE; foreach ($javascript as $item) { @@ -436,12 +436,12 @@ function locale_js_alter(&$javascript) { unset($parsed['refresh:' . $language_interface->langcode]); } // Store any changes after refresh was attempted. - variable_set('javascript_parsed', $parsed); + state()->set('javascript_parsed', $parsed); } // If no refresh was attempted, but we have new source files, we need // to store them too. This occurs if current page is in English. elseif ($new_files) { - variable_set('javascript_parsed', $parsed); + state()->set('javascript_parsed', $parsed); } // Add the translation JavaScript file to the page. @@ -807,7 +807,7 @@ function _locale_parse_js_file($filepath) { * New content of the 'javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = variable_get('javascript_parsed', array()); + $parsed = state()->get('javascript_parsed') ?: array(); if (empty($langcode)) { // Invalidate all languages. @@ -824,7 +824,7 @@ function _locale_invalidate_js($langcode = NULL) { $parsed['refresh:' . $langcode] = 'waiting'; } - variable_set('javascript_parsed', $parsed); + state()->set('javascript_parsed', $parsed); return $parsed; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 3790f2b..e75c3c7 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1976,6 +1976,15 @@ function system_update_8021() { } /** + * Cleans up javascript_parsed variable. + * + * @ingroup system_upgrade + */ +function system_update_8022() { + update_variable_del('javascript_parsed'); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */