diff options
author | Christian Schneider | 2019-05-03 16:29:06 +0200 |
---|---|---|
committer | Christian Schneider | 2019-05-03 16:29:06 +0200 |
commit | 19fa47e678cef0cb3878e9378d1e178651035ae4 (patch) | |
tree | 4220fa1d1a925e485808861be790bc39a4cc00e8 | |
parent | 2992f97fcd84e65c12f34134b0905ec692a67c9d (diff) | |
download | itools-19fa47e678cef0cb3878e9378d1e178651035ae4.tar.gz itools-19fa47e678cef0cb3878e9378d1e178651035ae4.tar.bz2 itools-19fa47e678cef0cb3878e9378d1e178651035ae4.zip |
Add @param ['additional_data'] Additional data to be included in checksum
-rw-r--r-- | itjs.class | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -189,6 +189,8 @@ static function strip($code) /** * Compute checksum for list of files * @param $fnlist Either comma separated UNTRUSTED url (will check itjs/ and lib.search.ch/itjs/) or array of TRUSTED filenames + * @param $p['short_expire'] Check filemtime and generate short expires for new files + * @param $p['additional_data'] Additional data to be included in checksum * @return Checksum for given files */ static function checksum($fnlist, $p = array()) @@ -199,7 +201,7 @@ static function checksum($fnlist, $p = array()) foreach (is_array($fnlist) ? $fnlist : itjs::filenames($fnlist) as $filename) $filenames[] = !file_exists($filename) && file_exists($t = it::replace(array('^/www/[^/]*' => "/www/lib.search.ch"), $filename)) ? $t : $filename; - $key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames))); + $key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames)) . '|' . json_encode($p['additional_data'])); if ($filenames && $p['short_expire'] && (time() - max(@array_map('filemtime', $filenames)) < 60)) return "-"; # trigger short expire, our file may not yet be up to date on other slaves |