From 47f1ff523d738eb7d2e66ee7f689f62c5d6964de Mon Sep 17 00:00:00 2001 From: webchick Date: Mon, 30 Apr 2012 21:42:08 -0700 Subject: Issue #1404380 by msonnabaum, xjm, mjpa: Fixed Unnecessary aggregation of CSS/JS. --- includes/common.inc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index ff2549317..f3c936e95 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -3455,7 +3455,13 @@ function drupal_build_css_cache($css) { $data = ''; $uri = ''; $map = variable_get('drupal_css_cache_files', array()); - $key = hash('sha256', serialize($css)); + // Create a new array so that only the file names are used to create the hash. + // This prevents new aggregates from being created unnecessarily. + $css_data = array(); + foreach ($css as $css_file) { + $css_data[] = $css_file['data']; + } + $key = hash('sha256', serialize($css_data)); if (isset($map[$key])) { $uri = $map[$key]; } @@ -4816,7 +4822,13 @@ function drupal_build_js_cache($files) { $contents = ''; $uri = ''; $map = variable_get('drupal_js_cache_files', array()); - $key = hash('sha256', serialize($files)); + // 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(); + foreach ($files as $file) { + $js_data[] = $file['data']; + } + $key = hash('sha256', serialize($js_data)); if (isset($map[$key])) { $uri = $map[$key]; } -- cgit v1.2.3