diff options
author | Urban Müller | 2016-01-13 13:44:46 +0100 |
---|---|---|
committer | Urban Müller | 2016-01-13 13:45:21 +0100 |
commit | 9c14abfe4a94c03c6b4df26fb0e3d1c4350293bd (patch) | |
tree | 5a6d2fd9af7f11eb5066c0887f575cb4ca1fa3d5 /itjs.class | |
parent | 19d26f57562cd7b755f22ecdc76b0dadb30a2919 (diff) | |
download | itools-9c14abfe4a94c03c6b4df26fb0e3d1c4350293bd.tar.gz itools-9c14abfe4a94c03c6b4df26fb0e3d1c4350293bd.tar.bz2 itools-9c14abfe4a94c03c6b4df26fb0e3d1c4350293bd.zip |
handle empty filelist, handle scripts with query-args
Diffstat (limited to 'itjs.class')
-rw-r--r-- | itjs.class | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -133,7 +133,7 @@ static function filenames($filelist) foreach (it::match("[-\w.=?&]+", basename($filelist), array('all' => true)) as $file) # split by comma but ignore illegal chars { - $filenames = $special[$file] ?: (file_exists("$local/$file") ? "$local/$file" : "$libsearch/itjs/$file"); + $filenames = $special[$file] ?: (file_exists("$local/" . it::match('[^?]*', $file)) ? "$local/$file" : "$libsearch/itjs/$file"); foreach (explode(",", $filenames) as $filename) if (!$seen[$filename]++ && file_exists($filename)) @@ -194,6 +194,7 @@ static function checksum($fnlist, $p = array()) { $p += array('short_expire' => true); + $filenames = 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; @@ -202,9 +203,9 @@ static function checksum($fnlist, $p = array()) $key = "itjs_" . md5(join("", it::map('"$v" . @filemtime("$v")', $filenames))); - if ($p['short_expire'] && (time() - max(@array_map('filemtime', $filenames)) < 60)) + 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 - else + else if ($filenames) return it_cache::get($key) ?: it_cache::put($key, substr(md5(self::filecontents($filenames, false)), 0, 10), array('ttl' => 60)); } |