Commit 2b8ccd00 authored by Melissa Draper's avatar Melissa Draper Committed by Gerrit Code Review
Browse files

Merge "Additional processing fixes for rss to avoid fatal errors (Bug #1081431)"

parents 47094212 129e2627
...@@ -64,8 +64,15 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { ...@@ -64,8 +64,15 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
$data = $instance->get_data('feed', $configdata['feedid']); $data = $instance->get_data('feed', $configdata['feedid']);
$data->content = unserialize($data->content); if (isset($data) && is_string($data->content)) {
$data->image = unserialize($data->image); $data->content = unserialize($data->content);
}
if (isset($data) && (is_string($data->image) || is_array($data->image))) {
$data->image = @unserialize($data->image);
}
else {
$data->image = null;
}
// only keep the number of entries the user asked for // only keep the number of entries the user asked for
if (count($data->content)) { if (count($data->content)) {
...@@ -285,17 +292,30 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype { ...@@ -285,17 +292,30 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
} }
try { try {
$data = self::parse_feed($feed->url, $feed->insecuresslmode, $feed->authuser, $feed->authpassword); $data = self::parse_feed($feed->url, $feed->insecuresslmode, $feed->authuser, $feed->authpassword);
$data->id = $feed->id;
$data->lastupdate = db_format_timestamp(time());
$data->content = serialize($data->content);
$data->image = serialize($data->image);
update_record('blocktype_externalfeed_data', $data);
} }
catch (XML_Feed_Parser_Exception $e) { catch (XML_Feed_Parser_Exception $e) {
// The feed must have changed in such a way as to become // The feed must have changed in such a way as to become
// invalid since it was added. We ignore this case in the hope // invalid since it was added. We ignore this case in the hope
// the feed will become valid some time later // the feed will become valid some time later
} }
if (isset($data) && $data instanceof XML_Feed_Parser_Exception) {
continue;
}
else if (isset($data)) {
if (!isset($data->image)) {
$data->image = null;
}
try {
$data->content = $data->content ? serialize($data->content) : '' ;
$data->image = $data->image ? serialize($data->image) : '';
$data->id = $feed->id;
$data->lastupdate = db_format_timestamp(time());
update_record('blocktype_externalfeed_data', $data);
}
catch (XML_Feed_Parser_Exception $e) {
// We tried to add the newly parsed data
}
}
} }
} }
......
Markdown is supported
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