Skip to content
Snippets Groups Projects
Commit 4f84b1e7 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: Bad error management

parent 1168a43b
No related branches found
No related tags found
No related merge requests found
...@@ -183,6 +183,7 @@ class RssParser ...@@ -183,6 +183,7 @@ class RssParser
include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$rss='';
$str=''; // This will contain content of feed $str=''; // This will contain content of feed
// Check parameters // Check parameters
...@@ -213,7 +214,7 @@ class RssParser ...@@ -213,7 +214,7 @@ class RssParser
} }
else else
{ {
dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it.");
} }
} }
...@@ -235,7 +236,6 @@ class RssParser ...@@ -235,7 +236,6 @@ class RssParser
//var_dump($opts);exit; //var_dump($opts);exit;
$context = stream_context_create($opts); $context = stream_context_create($opts);
// FIXME avoid error if no connection
$str = file_get_contents($this->_urlRSS, false, $context); $str = file_get_contents($this->_urlRSS, false, $context);
} }
catch (Exception $e) { catch (Exception $e) {
...@@ -243,6 +243,8 @@ class RssParser ...@@ -243,6 +243,8 @@ class RssParser
} }
} }
if ($str !== false)
{
// Convert $str into xml // Convert $str into xml
if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) if (! empty($conf->global->EXTERNALRSS_USE_SIMPLEXML))
{ {
...@@ -265,6 +267,7 @@ class RssParser ...@@ -265,6 +267,7 @@ class RssParser
$rss=$this; $rss=$this;
//var_dump($rss->_format);exit; //var_dump($rss->_format);exit;
} }
}
// If $rss loaded // If $rss loaded
if ($rss) if ($rss)
...@@ -272,7 +275,7 @@ class RssParser ...@@ -272,7 +275,7 @@ class RssParser
// Save file into cache // Save file into cache
if (empty($foundintocache) && $cachedir) if (empty($foundintocache) && $cachedir)
{ {
dol_syslog("RssParser::parser cache file ".$newpathofdestfile." is saved onto disk."); dol_syslog(get_class($this)."::parser cache file ".$newpathofdestfile." is saved onto disk.");
if (! dol_is_dir($cachedir)) dol_mkdir($cachedir); if (! dol_is_dir($cachedir)) dol_mkdir($cachedir);
$fp = fopen($newpathofdestfile, 'w'); $fp = fopen($newpathofdestfile, 'w');
fwrite($fp, $str); fwrite($fp, $str);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment