]> git.mjollnir.org Git - moodle.git/commitdiff
blocks/rss_client: MDL-13932 Incease timeout when adding feeds
authorpoltawski <poltawski>
Fri, 31 Jul 2009 21:19:55 +0000 (21:19 +0000)
committerpoltawski <poltawski>
Fri, 31 Jul 2009 21:19:55 +0000 (21:19 +0000)
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..

blocks/rss_client/editfeed.php

index 1fd9813073b1f019c7acf32887a2badaf26e3db5..e14cb9a8b8a1e24273948ac844b2e97177a2a12f 100644 (file)
@@ -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());