Issue #1798796 by LinL, alexpott: Convert javascript_parsed() variable to use state system.
parent
91fec4d2d7
commit
9858e18829
|
@ -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'));
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue