core: use proxy when defined in HttpCachingBridgeAbstract

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-07-08 19:08:48 +02:00
parent d74beb6c6a
commit fe58d23c17

View file

@ -185,6 +185,7 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
// $this->message("loading cached file from ".$filename." for page at url ".$url); // $this->message("loading cached file from ".$filename." for page at url ".$url);
// TODO touch file and its parent, and try to do neighbour deletion // TODO touch file and its parent, and try to do neighbour deletion
$this->refresh_in_cache($pageCacheDir, $filename); $this->refresh_in_cache($pageCacheDir, $filename);
$content=file_get_contents($filename);
} else { } else {
// $this->message("we have no local copy of ".$url." Downloading to ".$filename); // $this->message("we have no local copy of ".$url." Downloading to ".$filename);
$dir = substr($filename, 0, strrpos($filename, '/')); $dir = substr($filename, 0, strrpos($filename, '/'));
@ -192,9 +193,12 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
// $this->message("creating directories for ".$dir); // $this->message("creating directories for ".$dir);
mkdir($dir, 0777, true); 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) { public function get_cached_time($url) {