1
From: Wolfgang Sourdeau <wsourdeau@inverse.ca>
2
Date: Thu, 24 May 2012 14:26:45 +0000
3
Subject: Fix stale cache issue when upgrading
5
Origin: upstream, http://mtn.inverse.ca/revision/info/b2721d7f18528c981a921065d3272cca1a9070e8
7
sope-appserver/WEExtensions/ChangeLog | 8 ++++++++
8
sope-appserver/WEExtensions/WEResourceManager.m | 15 ++++++++++-----
9
2 files changed, 18 insertions(+), 5 deletions(-)
11
diff --git a/sope-appserver/WEExtensions/ChangeLog b/sope-appserver/WEExtensions/ChangeLog
12
index 771dc98..ff32f17 100644
13
--- a/sope-appserver/WEExtensions/ChangeLog
14
+++ b/sope-appserver/WEExtensions/ChangeLog
16
+2012-05-24 Wolfgang Sourdeau <wsourdeau@inverse.ca>
18
+ * WEResourceManager.m
19
+ (_urlForResourceNamed:inFramework:language:applicationName:):
20
+ append "lm=" + the unix timestamp of the file last modification
21
+ date to force a reload of the file each time it is modified, no
22
+ matter what expiry date the browsers are using in their cache.
24
2010-01-29 Wolfgang Sourdeau <wsourdeau@inverse.ca>
27
diff --git a/sope-appserver/WEExtensions/WEResourceManager.m b/sope-appserver/WEExtensions/WEResourceManager.m
28
index a7ed87f..03aa8b5 100644
29
--- a/sope-appserver/WEExtensions/WEResourceManager.m
30
+++ b/sope-appserver/WEExtensions/WEResourceManager.m
31
@@ -575,8 +575,7 @@ checkCache(NSDictionary *_cache, WEResourceKey *_key,
33
[ms appendString:_name];
36
- [ms release]; ms = nil;
38
if (debugOn) [self debugWithFormat:@"FOUND: '%@'", url];
41
@@ -589,6 +588,7 @@ checkCache(NSDictionary *_cache, WEResourceKey *_key,
42
while ((path = [e nextObject])) {
44
NSString *fpath, *basepath;
45
+ NSDate *lastModified;
49
@@ -608,7 +608,11 @@ checkCache(NSDictionary *_cache, WEResourceKey *_key,
51
if (![fm fileExistsAtPath:fpath])
55
+ lastModified = [[fm fileAttributesAtPath: fpath
57
+ fileModificationDate];
59
ms = [[NSMutableString alloc] initWithCapacity:256];
61
if (prefix) [ms appendString:prefix];
62
@@ -622,9 +626,10 @@ checkCache(NSDictionary *_cache, WEResourceKey *_key,
63
[ms appendString:@".lproj/"];
65
[ms appendString:_name];
66
+ [ms appendFormat: @"?lm=%u",
67
+ (NSUInteger) [lastModified timeIntervalSince1970]];
70
- [ms release]; ms = nil;
72
if (debugOn) [self debugWithFormat:@"FOUND: '%@'", url];