Updates yepnope cache in jsinit.cs to append correct rnd value

This commit is contained in:
perploug
2014-02-19 00:15:22 +01:00
parent 81305173ca
commit 7ed11c04c5
4 changed files with 19 additions and 10 deletions

View File

@@ -41,13 +41,21 @@ namespace Umbraco.Web.UI.JavaScript
public string GetJavascriptInitialization(HttpContextBase httpContext, JArray umbracoInit, JArray additionalJsFiles = null)
{
var result = GetJavascriptInitializationArray(httpContext, umbracoInit, additionalJsFiles);
var noCache = string.Empty;
//if debugging, add timestamp, if in production CDF will append CDF version (and should also append umb version)
var noCache = Resources.JsNoCache;
//if debugging, add timestamp, if in production we tell yepNope to append umb+cdf version
//this is needed even tho cdf does this on its serverside merged js
//as assetsService.load() also need to append these versions to ensure cache bursting on updates + pack installs
if (httpContext.IsDebuggingEnabled)
noCache = Resources.JsNoCache;
noCache = noCache.Replace("##rnd##", "(new Date).getTime()");
else
{
var version = "'" + Umbraco.Core.Configuration.UmbracoVersion.Current.ToString() + "." + ClientDependency.Core.Config.ClientDependencySettings.Instance.Version + "'";
noCache = noCache.Replace("##rnd##", version);
}
return ParseMain(
noCache,
result.ToString(),

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18408
// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -89,6 +89,7 @@ namespace Umbraco.Web.UI.JavaScript {
/// <summary>
/// Looks up a localized string similar to yepnope.addFilter(function (resourceObj) {
/// var url = resourceObj.url;
/// var rnd = ##rnd##;
/// var _op = &quot;?&quot;;
/// if(url.indexOf(&quot;lib/&quot;) === 0 || url.indexOf(&quot;js/umbraco.&quot;) === 0){
/// return resourceObj;
@@ -97,7 +98,7 @@ namespace Umbraco.Web.UI.JavaScript {
/// _op = &quot;&amp;&quot;;
/// }
///
/// resourceObj.url = resourceObj.url + _op + &quot;umb__rnd=&quot; + (new Date).getTime();
/// resourceObj.url = resourceObj.url + _op + &quot;umb__rnd=&quot; + rnd;
/// return resourceObj;
///});.
/// </summary>

View File

@@ -124,6 +124,7 @@
<data name="JsNoCache" xml:space="preserve">
<value>yepnope.addFilter(function (resourceObj) {
var url = resourceObj.url;
var rnd = ##rnd##;
var _op = "?";
if(url.indexOf("lib/") === 0 || url.indexOf("js/umbraco.") === 0){
return resourceObj;
@@ -132,7 +133,7 @@
_op = "&amp;";
}
resourceObj.url = resourceObj.url + _op + "umb__rnd=" + (new Date).getTime();
resourceObj.url = resourceObj.url + _op + "umb__rnd=" + rnd;
return resourceObj;
});</value>
</data>