summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
authorChristian Helbling2015-04-16 11:42:36 +0200
committerChristian Helbling2015-04-16 11:45:02 +0200
commit865503d8b6a19738aeaa44b71cb0bfc16b7592ed (patch)
treeb4b1eacbc1181e0ed7ff11cbc5c932f1096533ea /itjs.class
parent012daad10e6e533ed780b838b206271cae1dcc55 (diff)
downloaditools-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
Diffstat (limited to 'itjs.class')
-rw-r--r--itjs.class6
1 files changed, 4 insertions, 2 deletions
diff --git a/itjs.class b/itjs.class
index 5d9cd62..f20a3b7 100644
--- a/itjs.class
+++ b/itjs.class
@@ -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));