From fe58d23c17f3cfdb7d0e2f5ee4baa7c7bf4936cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Fri, 8 Jul 2016 19:08:48 +0200 Subject: [PATCH] core: use proxy when defined in HttpCachingBridgeAbstract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- lib/Bridge.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/Bridge.php b/lib/Bridge.php index c5a8ae05..f8592f3b 100644 --- a/lib/Bridge.php +++ b/lib/Bridge.php @@ -185,6 +185,7 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract { // $this->message("loading cached file from ".$filename." for page at url ".$url); // TODO touch file and its parent, and try to do neighbour deletion $this->refresh_in_cache($pageCacheDir, $filename); + $content=file_get_contents($filename); } else { // $this->message("we have no local copy of ".$url." Downloading to ".$filename); $dir = substr($filename, 0, strrpos($filename, '/')); @@ -192,11 +193,14 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract { // $this->message("creating directories for ".$dir); mkdir($dir, 0777, true); } - $this->download_remote($url, $filename); + $content=$this->getContents($url); + if($content!==false){ + file_put_contents($filename,$content); + } } - return file_get_contents($filename); + return $content; } - + public function get_cached_time($url) { $simplified_url = str_replace(["http://", "https://", "?", "&", "="], ["", "", "/", "/", "/"], $url); // TODO build this from the variable given to Cache