Created
November 11, 2010 16:48
-
-
Save briantully/672775 to your computer and use it in GitHub Desktop.
proposed patch to common.inc for timetamp to css/js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: common.inc | |
=================================================================== | |
--- common.inc (revision 12104) | |
+++ common.inc (working copy) | |
@@ -1855,6 +1855,7 @@ | |
// flush, forcing browsers to load a new copy of the files, as the | |
// URL changed. | |
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); | |
+ $timestamp = variable_get('css_js_timestamp', '0'); | |
foreach ($css as $media => $types) { | |
// If CSS preprocessing is off, we still need to output the styles. | |
@@ -1899,7 +1900,7 @@ | |
if ($is_writable && $preprocess_css) { | |
// Prefix filename to prevent blocking by firewalls which reject files | |
// starting with "ad*". | |
- $filename = 'css_'. md5(serialize($types) . $query_string) .'.css'; | |
+ $filename = 'css_'. md5(serialize($types) . $timestamp) .'.css'; | |
$preprocess_file = drupal_build_css_cache($types, $filename); | |
$output .= '<link type="text/css" rel="stylesheet" media="'. $media .'" href="'. base_path() . $preprocess_file . $query_string . '" />'."\n"; | |
} | |
@@ -2210,6 +2211,7 @@ | |
// get time() as query-string instead, to enforce reload on every | |
// page request. | |
$query_string = '?'. substr(variable_get('css_js_query_string', '0'), 0, 1); | |
+ $timestamp = variable_get('css_js_timestamp', '0'); | |
// For inline Javascript to validate as XHTML, all Javascript containing | |
// XHTML needs to be wrapped in CDATA. To make that backwards compatible | |
@@ -2248,7 +2250,7 @@ | |
if ($is_writable && $preprocess_js && count($files) > 0) { | |
// Prefix filename to prevent blocking by firewalls which reject files | |
// starting with "ad*". | |
- $filename = 'js_'. md5(serialize($files) . $query_string) .'.js'; | |
+ $filename = 'js_'. md5(serialize($files) . $timestamp) .'.js'; | |
$preprocess_file = drupal_build_js_cache($files, $filename); | |
$preprocessed .= '<script type="text/javascript" src="'. base_path() . $preprocess_file . $query_string .'"></script>'."\n"; | |
} | |
@@ -3737,6 +3739,7 @@ | |
$new_character = $characters[mt_rand(0, strlen($characters) - 1)]; | |
} | |
variable_set('css_js_query_string', $new_character . substr($string_history, 0, 19)); | |
+ variable_set('css_js_timestamp', time()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment