Commit b73b8762 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Remove curl errors from cron log when refreshing rss feeds (bug #849574)"

parents f6a85873 7ee9b0d1
......@@ -313,7 +313,7 @@ class PluginBlocktypeExternalfeed extends SystemBlocktype {
CURLOPT_USERAGENT => '',
);
$result = mahara_http_request($config);
$result = mahara_http_request($config, true);
if ($result->error) {
throw new XML_Feed_Parser_Exception($result->error);
......
......@@ -3186,7 +3186,7 @@ function build_pagination_pagelink($class, $url, $offset, $text, $title, $disabl
return $return;
}
function mahara_http_request($config) {
function mahara_http_request($config, $quiet=false) {
$ch = curl_init();
// standard curl_setopt stuff; configs passed to the function can override these
......@@ -3220,7 +3220,17 @@ function mahara_http_request($config) {
$result->errno = curl_errno($ch);
if ($result->errno) {
log_warn('Curl error: ' . $result->errno . ': ' . $result->error);
if ($quiet) {
// When doing something unimportant like fetching rss feeds, some errors should not pollute the logs.
$dontcare = array(
CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, CURLE_PARTIAL_FILE, CURLE_OPERATION_TIMEOUTED,
CURLE_GOT_NOTHING,
);
$quiet = in_array($result->errno, $dontcare);
}
if (!$quiet) {
log_warn('Curl error: ' . $result->errno . ': ' . $result->error);
}
}
curl_close($ch);
......
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