diff --git a/core/includes/common.inc b/core/includes/common.inc index b3dc9cbcf37..0f252cacfd6 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -4774,7 +4774,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('system.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 9f6342010ce..f3c528d56aa 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('system.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 30dd7888407..b4709633e41 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('system.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 eba008c0d03..e4b68ee5011 100644 --- a/core/modules/locale/locale.module +++ b/core/modules/locale/locale.module @@ -473,7 +473,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('system.javascript_parsed') ?: array(); $files = $new_files = FALSE; foreach ($javascript as $item) { @@ -506,12 +506,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('system.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('system.javascript_parsed', $parsed); } // Add the translation JavaScript file to the page. @@ -895,10 +895,10 @@ function _locale_parse_js_file($filepath) { * The language code for which the file needs to be refreshed. * * @return - * New content of the 'javascript_parsed' variable. + * New content of the 'system.javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = variable_get('javascript_parsed', array()); + $parsed = state()->get('system.javascript_parsed') ?: array(); if (empty($langcode)) { // Invalidate all languages. @@ -912,7 +912,7 @@ function _locale_invalidate_js($langcode = NULL) { $parsed['refresh:' . $langcode] = 'waiting'; } - variable_set('javascript_parsed', $parsed); + state()->set('system.javascript_parsed', $parsed); return $parsed; } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index ba8bfaa2268..b1cf3750173 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2145,6 +2145,15 @@ function system_update_8026() { } } +/** + * Cleans up javascript_parsed variable. + * + * @ingroup system_upgrade + */ +function system_update_8027() { + update_variable_del('javascript_parsed'); +} + /** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000.