Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / zoneminder / 0001-Don-t-use-file-timestamp-in-cache-filename.patch
blobca2792099bd16edd9c173de4b36831f85d4114a8
1 From 8823e48b055b7e574c08069048ba21ffa4393699 Mon Sep 17 00:00:00 2001
2 From: Daniel Fullmer <danielrf12@gmail.com>
3 Date: Fri, 21 Feb 2020 21:52:00 -0500
4 Subject: [PATCH] Don't use file timestamp in cache filename
6 Every file in the nix store has a timestamp of "1", meaning that the
7 filename would remain constant even when changing zoneminder versions.
8 This would mean that newer versions would use the existing symlink to an
9 older version of the source file. We replace SRC_HASH in nix with a
10 hash of the source used to build zoneminder to ensure this filename is
11 unique.
12 ---
13 web/includes/functions.php | 3 ++-
14 1 file changed, 2 insertions(+), 1 deletion(-)
16 diff --git a/web/includes/functions.php b/web/includes/functions.php
17 index 89d2cc8ad..52cbb6f38 100644
18 --- a/web/includes/functions.php
19 +++ b/web/includes/functions.php
20 @@ -1941,7 +1941,8 @@ function cache_bust($file) {
21 $parts = pathinfo($file);
22 global $css;
23 $dirname = str_replace('/', '_', $parts['dirname']);
24 - $cacheFile = $dirname.'_'.$parts['filename'].'-'.$css.'-'.filemtime($file).'.'.$parts['extension'];
25 + $srcHash = '@srcHash@';
26 + $cacheFile = $dirname.'_'.$parts['filename'].'-'.$css.'-'.$srcHash.'.'.$parts['extension'];
27 if ( file_exists(ZM_DIR_CACHE.'/'.$cacheFile) or symlink(ZM_PATH_WEB.'/'.$file, ZM_DIR_CACHE.'/'.$cacheFile) ) {
28 return 'cache/'.$cacheFile;
29 } else {
30 --
31 2.32.0