Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zoneminder: add patch to fix improper caching
- Loading branch information
1 parent
cb5da4e
commit ce34b92
Showing
2 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
pkgs/servers/zoneminder/0001-Don-t-use-file-timestamp-in-cache-filename.patch
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From db38a11228eceea10dc97ecc87023b4919caa918 Mon Sep 17 00:00:00 2001 | ||
From: Daniel Fullmer <danielrf12@gmail.com> | ||
Date: Fri, 21 Feb 2020 21:52:00 -0500 | ||
Subject: [PATCH] Don't use file timestamp in cache filename | ||
|
||
Every file in the nix store has a timestamp of "1", meaning that the | ||
filename would remain constant even when changing zoneminder versions. | ||
This would mean that newer versions would use the existing symlink to an | ||
older version of the source file. We replace SRC_HASH in nix with a | ||
hash of the source used to build zoneminder to ensure this filename is | ||
unique. | ||
--- | ||
web/includes/functions.php | 3 ++- | ||
1 file changed, 2 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/web/includes/functions.php b/web/includes/functions.php | ||
index 19567a5c1..0242c09bc 100644 | ||
--- a/web/includes/functions.php | ||
+++ b/web/includes/functions.php | ||
@@ -2223,7 +2223,8 @@ function cache_bust($file) { | ||
$parts = pathinfo($file); | ||
global $css; | ||
$dirname = preg_replace('/\//', '_', $parts['dirname']); | ||
- $cacheFile = $dirname.'_'.$parts['filename'].'-'.$css.'-'.filemtime($file).'.'.$parts['extension']; | ||
+ $srcHash = '@srcHash@'; | ||
+ $cacheFile = $dirname.'_'.$parts['filename'].'-'.$css.'-'.$srcHash.'.'.$parts['extension']; | ||
if ( file_exists(ZM_DIR_CACHE.'/'.$cacheFile) or symlink(ZM_PATH_WEB.'/'.$file, ZM_DIR_CACHE.'/'.$cacheFile) ) { | ||
return 'cache/'.$cacheFile; | ||
} else { | ||
-- | ||
2.25.1 | ||
|
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