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

ad-hoc refresh_mod_calendar_events_task for deleted course runs on every cron

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Create some assignments. 

      Copy the attached php script to your moodle root and run it.

      php delete_assign_cm_records.php

      WARNING THIS WILL INTENTIONALLY DELETE ALL course_module records for all assignments on your site!!!! THIS IS A TESTING ONLY SCRIPT!

      Now run the cron from cli.

      php admin/cli/cron.php

      Verify the refresh_calendar_events adhoc task completes.

      Show
      Create some assignments.  Copy the attached php script to your moodle root and run it. php delete_assign_cm_records.php WARNING THIS WILL INTENTIONALLY DELETE ALL course_module records for all assignments on your site!!!! THIS IS A TESTING ONLY SCRIPT! Now run the cron from cli. php admin/cli/cron.php Verify the refresh_calendar_events adhoc task completes.
    • Workaround:
      Hide

      Delete the refresh calendar adhoc tasks event from your task_adhoc table.

      Show
      Delete the refresh calendar adhoc tasks event from your task_adhoc table.
    • Affected Branches:
      MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-59909-master

      Description

      I can see the following error when running cron, ad-hoc task is not marked as finished and runs again on the next cron

      Execute adhoc task: core\task\refresh_mod_calendar_events_task
      ... started 14:10:15. Current memory use 57.5MB.
      Refreshing events for assign
      Refreshing events for assignment
      Refreshing events for book
      Refreshing events for chat
      Refreshing events for choice
      Refreshing events for data
      Refreshing events for feedback
      Refreshing events for folder
      Refreshing events for forum
      Refreshing events for glossary
      Refreshing events for imscp
      Refreshing events for label
      Refreshing events for lesson
      Refreshing events for lti
      Refreshing events for page
      Refreshing events for quiz
      Refreshing events for resource
      Refreshing events for scorm
      Refreshing events for survey
      PHP Notice:  Trying to get property of non-object in /MOODLE/course/lib.php on line 1452
       
      Notice: Trying to get property of non-object in /MOODLE/course/lib.php on line 1452
      PHP Notice:  Trying to get property of non-object in /MOODLE/course/lib.php on line 1457
       
      Notice: Trying to get property of non-object in /MOODLE/course/lib.php on line 1457
      PHP Notice:  Trying to get property of non-object in /MOODLE/course/lib.php on line 1457
       
      Notice: Trying to get property of non-object in /MOODLE/course/lib.php on line 1457
      ... used 2576 dbqueries
      ... used 0.90151309967041 seconds
      Adhoc task failed: core\task\refresh_mod_calendar_events_task,Can not find data record in database table course.
      Debug info:
      SELECT * FROM {course} WHERE id = ?
      [array (
        0 => '0',
      )]
      Backtrace:
      * line 1522 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      * line 588 of /lib/datalib.php: call to moodle_database->get_record()
      * line 64 of /completion/classes/api.php: call to get_course()
      * line 1457 of /course/lib.php: call to core_completion\api::update_completion_date_event()
      * line 1437 of /course/lib.php: call to course_module_calendar_event_update_process()
      * line 70 of /lib/classes/task/refresh_mod_calendar_events_task.php: call to course_module_bulk_update_calendar_events()
      * line 81 of /lib/cronlib.php: call to core\task\refresh_mod_calendar_events_task->execute()
      * line 61 of /admin/cli/cron.php: call to cron_run()
      
      

      To reproduce:
      1. Install Moodle 3.2.
      2. Create a course.
      3. Enable completion.
      4. Add a survey activity.
      5. Under Activity completion, enable Completion tracking (Either manual or automatic would be fine).
      6. Enable and set a value for "Expect completed on".
      7. Upgrade to Moodle 3.3+.
      8. Open a terminal, go to your Moodle root directory and run the following:

        php admin/cli/cron.php
        

      9. Expected:
        • Cron successfully completes.
      10. Actual:
        • The above mentioned error comes up.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                6 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17