summaryrefslogtreecommitdiff
path: root/itjs.class
diff options
context:
space:
mode:
Diffstat (limited to 'itjs.class')
-rw-r--r--itjs.class7
1 files changed, 4 insertions, 3 deletions
diff --git a/itjs.class b/itjs.class
index 2be3842..715247c 100644
--- a/itjs.class
+++ b/itjs.class
@@ -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));
}