From: poltawski Date: Fri, 31 Jul 2009 21:19:55 +0000 (+0000) Subject: blocks/rss_client: MDL-13932 Incease timeout when adding feeds X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5966474298d37e34b37c140881425a334df75906;p=moodle.git blocks/rss_client: MDL-13932 Incease timeout when adding feeds In order to stop 'slow loading feeds' causing performance problems with standard moodle pages, i've set the timeout for simplepie quite low. When cron runs i've set this timeout high and cache duration low. The intention is that cron does all the hard work of connecting to remote sites and users get this fast fast fast from cache. However, in the case of adding a feed its probably better to try and get the feed more agressively.. --- diff --git a/blocks/rss_client/editfeed.php b/blocks/rss_client/editfeed.php index 1fd9813073..e14cb9a8b8 100644 --- a/blocks/rss_client/editfeed.php +++ b/blocks/rss_client/editfeed.php @@ -74,7 +74,11 @@ class feed_edit_form extends moodleform { function validation($data, $files) { $errors = parent::validation($data, $files); - $rss = new moodle_simplepie($data['url']); + $rss = new moodle_simplepie(); + // set timeout for longer than normal to try and grab the feed + $rss->set_timeout(10); + $rss->set_feed_url($data['url']); + $rss->init(); if ($rss->error()) { $errors['url'] = get_string('errorloadingfeed', 'block_rss_client', $rss->error());