diff options
| author | Urban Müller | 2025-11-03 15:51:10 +0100 |
|---|---|---|
| committer | Urban Müller | 2025-11-03 15:51:10 +0100 |
| commit | 52ca54d59f044e6deb8242115c1ee2e53915412b (patch) | |
| tree | 641e01daf7ad1310f59fc64d55f267c227285ae8 /it_url.class | |
| parent | 2e3beb6805f5f1695953e5735ebf0040833eb655 (diff) | |
| download | itools-52ca54d59f044e6deb8242115c1ee2e53915412b.tar.gz itools-52ca54d59f044e6deb8242115c1ee2e53915412b.tar.bz2 itools-52ca54d59f044e6deb8242115c1ee2e53915412b.zip | |
Diffstat (limited to 'it_url.class')
| -rw-r--r-- | it_url.class | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/it_url.class b/it_url.class index dadb1d5..48dbb6f 100644 --- a/it_url.class +++ b/it_url.class @@ -640,14 +640,15 @@ static function get_cache($p = array()) { $success = true; $isnewfile = it_url::_atomicwrite($path, $p['assoc'] ? ($data['status'] === 304 ? true : it::json_encode($data)) : $data); # $data === true means not modified (no new data fetched) and instructs _atomicwrite to just touch the file - if ($p['returnheaders']) - it::file_put("$path.json", it::json_encode($url->headers)); } else if ($p['keepfailed']) - $success = $fileexists; + $success = $kept = $fileexists; else @unlink($path); # Expired and failed to get + if ($p['returnheaders'] && !$kept) + it::file_put("$path.json", it::json_encode($url->headers)); + it_url::_unlock($path, $lock); } else |