summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
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));