Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-63086

Problems with refreshfeeds task and non-existing/non working feeds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 3.6
    • 3.6
    • Blocks, RSS, Tasks
    • MOODLE_36_STABLE
    • MOODLE_36_STABLE
    • MDL-63086-master
    • Hide
      1. Login as an admin
      2. Navigate to dashboard
      3. Customise the dashboard
      4. Add the RSS Block
      5. Configure the block:
        1. Add/edit feeds
        2. Add a new feed for https://github.com/moodlehq/moodle-php-apache/commits/master.atom
      6. Open a console and run the task:

        php admin/tool/task/cli/schedule_task.php --execute="\block_rss_client\task\refreshfeeds"
        

        1. Confirm that the feed was successfully refreshed
      7. Open a connection to your DB and change the URL to something bad:

        update mdl_block_rss_client set url = 'http://localhost';
        

      8. Re-run the task

        php admin/tool/task/cli/schedule_task.php --execute="\block_rss_client\task\refreshfeeds"
        

        1. Confirm that the feed failed
        2. Confirm that it will skip the feed for 300 seconds
      9. Run the task again
        1. Confirm that the feed was indeed skipped
      Show
      Login as an admin Navigate to dashboard Customise the dashboard Add the RSS Block Configure the block: Add/edit feeds Add a new feed for https://github.com/moodlehq/moodle-php-apache/commits/master.atom Open a console and run the task: php admin/tool/task/cli/schedule_task.php --execute="\block_rss_client\task\refreshfeeds" Confirm that the feed was successfully refreshed Open a connection to your DB and change the URL to something bad: update mdl_block_rss_client set url = 'http://localhost'; Re-run the task php admin/tool/task/cli/schedule_task.php --execute="\block_rss_client\task\refreshfeeds" Confirm that the feed failed Confirm that it will skip the feed for 300 seconds Run the task again Confirm that the feed was indeed skipped

      This is a regression of MDL-61960, that was integrated only for 3.6. Carrying information from there:

      Note that a regression with this patch has been detected. To reproduce:

      • Have a non-working rss feed in your site (you can edit one of the current ones to make it fail).
      • Run:

        php admin/tool/task/cli/schedule_task.php --execute=\\block_rss_client\\task\\refreshfeeds

      • You get:

        http://xxx.xxx.xxx.xxx/rss.xml PHP Notice: A feed could not be found at `http://xxx.xxx.xxx.xxx/rss.xml`; the status code is `503` and content-type is `text/html; charset=utf-8` in /lib/simplepie/library/SimplePie.php on line 1702
        Default exception handler: Exception - Class 'block_rss_client' not found Debug: 
        Error code: generalexceptionmessage
        * line 101 of /blocks/rss_client/classes/task/refreshfeeds.php: Error thrown
        * line 156 of /admin/tool/task/cli/schedule_task.php: call to block_rss_client\task\refreshfeeds->execute()
         
        !!! Exception - Class 'block_rss_client' not found !!!
        

      • Proposed solution 1, tested locally, just add the missing classes needed when a rss fails:

        diff --git a/blocks/rss_client/classes/task/refreshfeeds.php b/blocks/rss_client/classes/task/refreshfeeds.php
        index 3e34e1b183..0feb681bd3 100644
        --- a/blocks/rss_client/classes/task/refreshfeeds.php
        +++ b/blocks/rss_client/classes/task/refreshfeeds.php
        @@ -66,6 +66,8 @@ class refreshfeeds extends \core\task\scheduled_task {
             public function execute() {
                 global $CFG, $DB;
                 require_once($CFG->libdir.'/simplepie/moodle_simplepie.php');
        +        require_once($CFG->dirroot . '/blocks/moodleblock.class.php');
        +        require_once($CFG->dirroot . '/blocks/rss_client/block_rss_client.php');
         
                 // We are going to measure execution times.
                 $starttime = microtime();
        

      • Proposed solution 2, move the calculate_skiptime() method to the task, so no instantiation of the block is needed. It seems it's not used elsewhere.

      Ciao

            dobedobedoh Andrew Lyons
            stronk7 Eloy Lafuente (stronk7)
            Mihail Geshoski Mihail Geshoski
            Jake Dallimore Jake Dallimore
            Gladys Basiana Gladys Basiana
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 30 minutes
                30m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.