diff options
author | Urban Müller | 2022-03-11 13:33:20 +0100 |
---|---|---|
committer | Urban Müller | 2022-03-11 13:33:20 +0100 |
commit | d97a23f7af099998470b00f5f76363cb2b1bcab9 (patch) | |
tree | 9857f103f4d39a2809e36ef1170f10256f6c1a21 | |
parent | fdaeb6bb8d06fb8cf07ddb01105c049e056e18cf (diff) | |
download | itools-d97a23f7af099998470b00f5f76363cb2b1bcab9.tar.gz itools-d97a23f7af099998470b00f5f76363cb2b1bcab9.tar.bz2 itools-d97a23f7af099998470b00f5f76363cb2b1bcab9.zip |
store content extract on EDC("getcachelog") for get_cache debugging
-rw-r--r-- | it_url.class | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/it_url.class b/it_url.class index 356c938..0e81354 100644 --- a/it_url.class +++ b/it_url.class @@ -583,9 +583,10 @@ static function get_cache($p = array()) EDC('getcache', "new", $filemtime, $p['url'], $path); $url = new it_url; - if ($success = $url->_get($p + ['checkonly' => true, 'filemtime' => EDC('nocache') ? null : $filemtime])) # => true means not modified (no new data fetched) + if ($data = $url->_get($p + ['checkonly' => true, 'filemtime' => EDC('nocache') ? null : $filemtime])) # => true means not modified (no new data fetched) { - $newfile = it_url::_atomicwrite($path, $p['assoc'] ? serialize($success) : $success); + $success = true; + $newfile = it_url::_atomicwrite($path, $p['assoc'] ? serialize($data) : $data); if ($p['returnheaders']) it::file_put_contents("$path.headers", '<?php return ' . var_export($url->headers, true) . ";\n"); } @@ -648,7 +649,6 @@ static function get_cache($p = array()) $success = file_exists($path); } - $cachemiss = 1; it_url::_unlock($path, $lock); } else @@ -669,7 +669,7 @@ static function get_cache($p = array()) } if (EDC('getcachelog')) - it::log('debug', 'getcachelog', "miss=" . intval($cachemiss), $p['url']); + it::log('debug', 'getcachelog', $p['id'], $p['url'], $newfile ? "fetched=" . mb_substr($data, 0, 500) : ""); ### EDC('getcache', $success, $path); # too verbose return $success ? ($p['returnheaders'] ? array($path, $headers) : $path) : false; |