diff options
author | Christian Helbling | 2015-04-16 11:42:36 +0200 |
---|---|---|
committer | Christian Helbling | 2015-04-16 11:45:02 +0200 |
commit | 865503d8b6a19738aeaa44b71cb0bfc16b7592ed (patch) | |
tree | b4b1eacbc1181e0ed7ff11cbc5c932f1096533ea | |
parent | 012daad10e6e533ed780b838b206271cae1dcc55 (diff) | |
download | itools-865503d8b6a19738aeaa44b71cb0bfc16b7592ed.tar.gz itools-865503d8b6a19738aeaa44b71cb0bfc16b7592ed.tar.bz2 itools-865503d8b6a19738aeaa44b71cb0bfc16b7592ed.zip |
make short expire an option as itjs::checksum usage is different depending on whether we have the checksum in the url or not
-rw-r--r-- | itjs.class | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -193,12 +193,14 @@ static function strip($code) * @param $fnlist Either comma separated url or array of filenames to calculate checksum for * @return Checksum for given files */ -static function checksum($fnlist) +static function checksum($fnlist, $p = array()) { + $p += array('short_expire' => true); + $filenames = array_merge(is_array($fnlist) ? $fnlist : itjs::filenames($fnlist), array("/www/lib.search.ch/var/jquery-ui/dist/minified/jquery.ui.core.min.js", "/www/lib.search.ch/var/jquery/dist/jquery.min.js")); # jquery files included by lib/jquery.js $key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames))); - if (time() - max(@array_map('filemtime', $filenames)) < 60) + if ($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 else return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames, false)), 0, 10), array('ttl' => 60)); |