This repository has been archived by the owner. It is now read-only.

Graceful return when update manifest cannot be parsed #174

Merged
merged 5 commits into from Aug 4, 2011
@@ -28,6 +28,9 @@
falls back to MooRainbow in all other browsers. Also adds the corresponding JFormRule for
validation.</para>
</listitem>
+ <listitem>
+ <para>Implemented graceful failure when update manifest is not available</para>
+ </listitem>
<listitem>
<para></para>
</listitem>
@@ -223,7 +223,10 @@ public function findUpdate($options)
$query->where('update_site_id = ' . $this->_update_site_id);
$dbo->setQuery($query);
$dbo->Query();
- JError::raiseWarning('101', JText::sprintf('JLIB_UPDATER_ERROR_COLLECTION_OPEN_URL', $url));
+
+ JLog::add("Error parsing url: ".$url, JLog::WARNING, 'updater');
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_COLLECTION_OPEN_URL', $url), 'warning');
return false;
}
@@ -235,9 +238,10 @@ public function findUpdate($options)
{
if (!xml_parse($this->xml_parser, $data, feof($fp)))
{
- die(
- sprintf("XML error: %s at line %d", xml_error_string(xml_get_error_code($this->xml_parser)),
- xml_get_current_line_number($this->xml_parser)));
+ JLog::add("Error parsing url: ".$url, JLog::WARNING, 'updater');
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_COLLECTION_PARSE_URL', $url), 'warning');
+ return false;
}
}
// TODO: Decrement the bad counter if non-zero
@@ -162,7 +162,10 @@ public function findUpdate($options)
$query->where('update_site_id = ' . $this->_update_site_id);
$dbo->setQuery($query);
$dbo->Query();
- JError::raiseWarning('101', JText::sprintf('JLIB_UPDATER_ERROR_EXTENSION_OPEN_URL', $url));
+
+ JLog::add("Error opening url: ".$url, JLog::WARNING, 'updater');
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_EXTENSION_OPEN_URL', $url), 'warning');
return false;
}
@@ -175,13 +178,10 @@ public function findUpdate($options)
{
if (!xml_parse($this->xml_parser, $data, feof($fp)))
{
- die(
- sprintf(
- 'XML error: %s at line %d',
- xml_error_string(xml_get_error_code($this->xml_parser)),
- xml_get_current_line_number($this->xml_parser)
- )
- );
+ JLog::add("Error parsing url: ".$url, JLog::WARNING, 'updater');
+ $app = JFactory::getApplication();
+ $app->enqueueMessage(JText::sprintf('JLIB_UPDATER_ERROR_EXTENSION_PARSE_URL', $url), 'warning');
+ return false;
}
}
xml_parser_free($this->xml_parser);