core: use proxy when defined in RssExpander

Signed-off-by: Pierre Mazière <pierre.maziere@gmx.com>
This commit is contained in:
Pierre Mazière 2016-07-08 19:26:07 +02:00
parent 226484ba22
commit 86515a1560

View file

@ -77,7 +77,7 @@ abstract class BridgeAbstract implements BridgeInterface{
/** /**
* Define default bridge name * Define default bridge name
*/ */
public function getName(){ public function getName(){
return $this->name; return $this->name;
} }
@ -166,7 +166,7 @@ abstract class BridgeAbstract implements BridgeInterface{
* After all, rss-bridge is not respaw, isn't it ? * After all, rss-bridge is not respaw, isn't it ?
*/ */
abstract class HttpCachingBridgeAbstract extends BridgeAbstract { abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
/** /**
* Maintain locally cached versions of pages to download to avoid multiple doiwnloads. * Maintain locally cached versions of pages to download to avoid multiple doiwnloads.
* A file name is generated by replacing all "/" by "_", and the file is saved below this bridge cache * A file name is generated by replacing all "/" by "_", and the file is saved below this bridge cache
@ -213,7 +213,7 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
$this->get_cached($url); $this->get_cached($url);
} }
return filectime($filename); return filectime($filename);
} }
private function refresh_in_cache($pageCacheDir, $filename) { private function refresh_in_cache($pageCacheDir, $filename) {
$currentPath = $filename; $currentPath = $filename;
@ -267,7 +267,7 @@ class Bridge{
} }
$pathBridge = self::getDir() . $nameBridge . '.php'; $pathBridge = self::getDir() . $nameBridge . '.php';
if( !file_exists($pathBridge) ){ if( !file_exists($pathBridge) ){
throw new \Exception('The bridge you looking for does not exist. It should be at path '.$pathBridge); throw new \Exception('The bridge you looking for does not exist. It should be at path '.$pathBridge);
} }
@ -349,8 +349,11 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{
} }
// $this->message("Loading from ".$param['url']); // $this->message("Loading from ".$param['url']);
// Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time // Notice WE DO NOT use cache here on purpose : we want a fresh view of the RSS stream each time
$rssContent = simplexml_load_file($name) or $this->returnServerError('Could not request '.$name); $content=$this->getContents($name) or
// $this->message("loaded RSS from ".$param['url']); $this->returnServerError('Could not request '.$name);
$rssContent = simplexml_load_string($content);
// $this->message("loaded RSS from ".$param['url']);
// TODO insert RSS format detection // TODO insert RSS format detection
// we suppose for now, we have some RSS 2.0 // we suppose for now, we have some RSS 2.0
$this->collect_RSS_2_0_data($rssContent); $this->collect_RSS_2_0_data($rssContent);