Commit 33297f59 authored by Nigel McNie's avatar Nigel McNie
Browse files

Handle errors from curl much more gracefully when attempting to grab RSS feeds.



Prevents a horrible crash at import time.
Signed-off-by: default avatarNigel McNie <nigel@catalyst.net.nz>
parent fcbb2177
...@@ -273,11 +273,8 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { ...@@ -273,11 +273,8 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$result = mahara_http_request($config); $result = mahara_http_request($config);
if($result->data) { if ($result->error) {
if ($result->error) { throw new XML_Feed_Parser_Exception($result->error);
$cache[$source] = $result->error;
throw $cache[$source];
}
} }
try { try {
...@@ -398,7 +395,13 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { ...@@ -398,7 +395,13 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
// RSS feeds for this user at import time, which could easily be quite // RSS feeds for this user at import time, which could easily be quite
// slow. This plugin will need a bit of re-working for this to be possible // slow. This plugin will need a bit of re-working for this to be possible
if (!empty($config['config']['url'])) { if (!empty($config['config']['url'])) {
$values = self::instance_config_save(array('url' => $config['config']['url'])); try {
$values = self::instance_config_save(array('url' => $config['config']['url']));
}
catch (XML_Feed_Parser_Exception $e) {
log_info("Note: was unable to parse RSS feed for new blockinstance. URL was {$config['config']['url']}");
$values = array();
}
} }
$bi = new BlockInstance(0, $bi = new BlockInstance(0,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment