# HG changeset patch # User Dan # Date 1261898901 18000 # Node ID 704ba4b9819bda9380bb38fce06e93e29632b3d7 # Parent 449fdd113eb086d3f32f82e083b3f90f3d700e1a All javascript and css requests now append the version number to the URL to break browser caches and prevent from having to clear the cache upon upgrade diff -r 449fdd113eb0 -r 704ba4b9819b includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Sun Dec 27 02:27:35 2009 -0500 +++ b/includes/clientside/static/enano-lib-basic.js Sun Dec 27 02:28:21 2009 -0500 @@ -294,7 +294,7 @@ if ( !multiple ) file = file + '.js'; - var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + (multiple ? file_flat : file ) : scriptPath + '/includes/clientside/static/' + file; + var uri = ( ENANO_JSRES_COMPRESSED ) ? scriptPath + '/includes/clientside/jsres.php?f=' + (multiple ? file_flat : file ) + '&' + enano_version : scriptPath + '/includes/clientside/static/' + file + '?' + enano_version; try { ajax.open('GET', uri, false); diff -r 449fdd113eb0 -r 704ba4b9819b includes/clientside/static/l10n.js --- a/includes/clientside/static/l10n.js Sun Dec 27 02:27:35 2009 -0500 +++ b/includes/clientside/static/l10n.js Sun Dec 27 02:28:21 2009 -0500 @@ -19,7 +19,7 @@ load_show_win('strings'); console.info('Loading language ' + lang_id + ' via AJAX synchronous request'); var ajax = ajaxMakeXHR(); - var uri = makeUrlNS('Special', 'LangExportJSON/' + lang_id); + var uri = makeUrlNS('Special', 'LangExportJSON/' + lang_id, enano_version); ajax.open('GET', uri, false); ajax.send(null); if ( ajax.readyState == 4 && ajax.status == 200 ) diff -r 449fdd113eb0 -r 704ba4b9819b includes/template.php --- a/includes/template.php Sun Dec 27 02:27:35 2009 -0500 +++ b/includes/template.php Sun Dec 27 02:28:21 2009 -0500 @@ -514,13 +514,16 @@ $ash = ''; } + // Append the Enano version to URLs to break the cache on upgrades + $enano_version = enano_version(); + // Set up javascript includes // these depend heavily on whether we have a CDN to work with or not if ( getConfig('cdn_path') ) { // we're on a CDN, point to static includes // CLI javascript compression script: includes/clientside/jscompress.php - $js_head = ''; + $js_head = ''; if ( !empty($this->js_preload) ) { @@ -536,12 +539,12 @@ foreach ( $this->js_preload as $script ) { - $js_head .= "\n "; + $js_head .= "\n "; // special case for l10n: also load strings if ( $script == 'l10n.js' ) { global $lang; - $js_head .= "\n "; + $js_head .= "\n "; } $loadlines[] = "loaded_components['$script'] = true;"; } @@ -578,7 +581,7 @@ // point to jsres compressor $js_head .= << - + JSEOF; $js_foot = ''; @@ -593,16 +596,16 @@ { // special case for l10n: also load strings global $lang; - $js_foot .= "\n "; + $js_foot .= "\n "; } $scripts = implode(',', $this->js_preload); - $js_foot .= "\n "; + $js_foot .= "\n "; } $js_foot .= << - +