1
0
Fork 0
forked from blallo/rss-bridge

[Bridge] Enable all calls to message($)

The 'message' function will only execute in debug mode, so
no harm done if left active.
This commit is contained in:
logmanoriginal 2016-08-24 18:19:42 +02:00
parent d80efed1f4
commit c0c4759cde

View file

@ -182,15 +182,15 @@ abstract class HttpCachingBridgeAbstract extends BridgeAbstract {
$filename = $filename."index.html"; $filename = $filename."index.html";
} }
if(file_exists($filename)) { if(file_exists($filename)) {
// $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); $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, '/'));
if(!is_dir($dir)) { if(!is_dir($dir)) {
// $this->message("creating directories for ".$dir); $this->message("creating directories for ".$dir);
mkdir($dir, 0777, true); mkdir($dir, 0777, true);
} }
$content=$this->getContents($url); $content=$this->getContents($url);
@ -346,13 +346,13 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{
if (empty($name)) { if (empty($name)) {
$this->returnServerError('There is no $name for this RSS expander'); $this->returnServerError('There is no $name for this RSS expander');
} }
// $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
$content=$this->getContents($name) or $content=$this->getContents($name) or
$this->returnServerError('Could not request '.$name); $this->returnServerError('Could not request '.$name);
$rssContent = simplexml_load_string($content); $rssContent = simplexml_load_string($content);
// $this->message("loaded RSS from ".$param['url']); $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);
@ -360,10 +360,10 @@ abstract class RssExpander extends HttpCachingBridgeAbstract{
protected function collect_RSS_2_0_data($rssContent) { protected function collect_RSS_2_0_data($rssContent) {
$rssContent = $rssContent->channel[0]; $rssContent = $rssContent->channel[0];
// $this->message("RSS content is ===========\n".var_export($rssContent, true)."==========="); $this->message("RSS content is ===========\n".var_export($rssContent, true)."===========");
$this->load_RSS_2_0_feed_data($rssContent); $this->load_RSS_2_0_feed_data($rssContent);
foreach($rssContent->item as $item) { foreach($rssContent->item as $item) {
// $this->message("parsing item ".var_export($item, true)); $this->message("parsing item ".var_export($item, true));
$this->items[] = $this->parseRSSItem($item); $this->items[] = $this->parseRSSItem($item);
} }
} }