Commit 84e4e29a authored by catch's avatar catch
Browse files

Issue #1798724 by andreiashu, Albert Volkman, alexpott: Convert...

Issue #1798724 by andreiashu, Albert Volkman, alexpott: Convert drupal_js_cache_files() to State system.
parent 4d15b638
......@@ -4750,7 +4750,7 @@ function drupal_add_tabledrag($table_id, $action, $relationship, $group, $subgro
function drupal_build_js_cache($files) {
$contents = '';
$uri = '';
$map = state()->get('system.drupal_js_cache_files') ?: array();
$map = state()->get('system.js_cache_files') ?: array();
// Create a new array so that only the file names are used to create the hash.
// This prevents new aggregates from being created unnecessarily.
$js_data = array();
......@@ -4795,7 +4795,7 @@ function drupal_build_js_cache($files) {
}
}
$map[$key] = $uri;
state()->set('system.drupal_js_cache_files', $map);
state()->set('system.js_cache_files', $map);
}
return $uri;
}
......@@ -4805,7 +4805,7 @@ function drupal_build_js_cache($files) {
*/
function drupal_clear_js_cache() {
state()->delete('system.javascript_parsed');
state()->delete('system.drupal_js_cache_files');
state()->delete('system.js_cache_files');
file_scan_directory('public://js', '/.*/', array('callback' => 'drupal_delete_file_if_stale'));
}
......
......@@ -344,11 +344,11 @@ function testAggregationOrder() {
));
// Store the expected key for the first item in the cache.
$cache = array_keys(state()->get('system.drupal_js_cache_files') ?: array());
$cache = array_keys(state()->get('system.js_cache_files') ?: array());
$expected_key = $cache[0];
// Reset variables and add a file in a different scope first.
state()->delete('system.drupal_js_cache_files');
state()->delete('system.js_cache_files');
drupal_static_reset('drupal_add_js');
drupal_add_library('system', 'drupal');
drupal_add_js('some/custom/javascript_file.js', array('scope' => 'footer'));
......@@ -363,7 +363,7 @@ function testAggregationOrder() {
));
// Compare the expected key for the first file to the current one.
$cache = array_keys(state()->get('system.drupal_js_cache_files') ?: array());
$cache = array_keys(state()->get('system.js_cache_files') ?: array());
$key = $cache[0];
$this->assertEqual($key, $expected_key, 'JavaScript aggregation is not affected by ordering in different scopes.');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment