Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-44734 Move forum cron to a scheduled_task
  3. MDL-46881

Refactor forum scheduled task (cron) into several smaller cron tasks

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      A) Setup

      1. Start with a clean install of Moodle
      2. Ensure you have something like mailcatcher or MailHog running and configured
      3. Run the adhoc task processor to clear any pending adhoc tasks

        php admin/tool/task/cli/adhoc_task.php --execute
        

      4. Open Site administration and search for 'maxediting'
      5. Set the max editing time to 1 minute
      6. Create one new course
      7. Enrol 10 students (s1-s10), and two editing teachers (t1, t2) in the course
      8. Ensure that the "Activities" block is present in the course
      9. Ensure that each course has the "Announcements" forum
      10. Create forums for each of the other types. Ensure that you set the Subscription to 'Automatic':
        1. Standard
        2. Blog
        3. Question and Answer
        4. Each User
        5. Single simple discussion
      11. For each of the remaining students login and ensure the following are set:
        Note: To set the profile setting, open the user menu -> Preferences -> Forum preferences, and use the dropdown
        Note: To set the setting for all forums, follow the "Forum" link in the Activities block and use the toggle for each of the forums
        User Profile setting Setting for all forums
        s1 No digest (no change) Default (No digest)
        s2 No digest (no change) Complete digest
        s3 No digest (no change) Subjects only
        s4 Complete digest No digest
        s5 Complete digest Default (Complete)
        s6 Complete digest Subjects only
        s7 Subjects only digest No digest
        s8 Subjects only digest Complete
        s9 Subjects only digest Default (Subjects only)
        t1 No digest (no change) Default (No digest)
        t2 Complete digest Default (Complete)
      12. Login as s10
      13. Navigate to the course and select "Forum" in the activies block
        1. Unsubscribe from each forum (Note: You cannot unsubscribe from the News forum)
      14. Login as admin
      15. Start a new discussion in each of:
        1. Announcements
        2. Standard
        3. Q&A
        4. Each User
        5. Blog (Add a new topic)
          Note: for ease of testing I suggest you set a subject which includes the type of forum.
      16. Reply to a post in all of them (including the Single simple discussion)
        Note: For Blog you must "Discuss this topic"
      17. Wait 1 minute

      B) Visibility tests

      B1) Initial test (all forums visible)

      1. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      2. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      3. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement Yes No No Yes No No Yes No No Yes Yes No
          Standard Yes No No Yes No No Yes No No No Yes No
          Single Simple Discussion Yes No No Yes No No Yes No No No Yes No
          Each user Yes No No Yes No No Yes No No No Yes No
          Blog Yes No No Yes No No Yes No No No Yes No
          Q & A First only No No First only No No First only No No No All posts No

          Note: Yes means both the original post, and the reply to it

      4. Delete all of the messages in your mail client/catcher
      5. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      6. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      7. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Standard No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Single Simple Discussion No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Each user No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Blog No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Q & A No First only First only (Subject only) No First only First only (Subject only) No First only First only (Subject only) No No All posts

          Note: Yes means both the original post, and the reply to it

      8. Delete all of the messages in your mail client/catcher

      B2) Initially hidden, but made visible before send

      1. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      2. Open the course that the forums are all in
      3. From the settings menu, choose "Edit settings"
      4. Update the course visility to "Hide"
      5. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      6. Open the course that the forums are all in
      7. From the settings menu, choose "Edit settings"
      8. Update the course visility to "Show"
      9. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      10. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement Yes No No Yes No No Yes No No Yes Yes No
          Standard Yes No No Yes No No Yes No No No Yes No
          Single Simple Discussion Yes No No Yes No No Yes No No No Yes No
          Each user Yes No No Yes No No Yes No No No Yes No
          Blog Yes No No Yes No No Yes No No No Yes No
          Q & A First only No No First only No No First only No No No All posts No

          Note: Yes means both the original post, and the reply to it

      11. Delete all of the messages in your mail client/catcher
      12. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      13. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      14. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Standard No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Single Simple Discussion No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Each user No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Blog No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes
          Q & A No First only First only (Subject only) No First only First only (Subject only) No First only First only (Subject only) No No All posts

          Note: Yes means both the original post, and the reply to it

      15. Delete all of the messages in your mail client/catcher

      B3) Hidden course

      1. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      2. Open the course that the forums are all in
      3. From the settings menu, choose "Edit settings"
      4. Update the course visility to "Hide"
      5. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      6. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      7. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No Yes No
          Standard No No No No No No No No No No Yes No
          Single Simple Discussion No No No No No No No No No No Yes No
          Each user No No No No No No No No No No Yes No
          Blog No No No No No No No No No No Yes No
          Q & A No No No No No No No No No No All posts No

          Note: Yes means both the original post, and the reply to it

      8. Delete all of the messages in your mail client/catcher
      9. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      10. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      11. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No No Yes
          Standard No No No No No No No No No No No Yes
          Single Simple Discussion No No No No No No No No No No No Yes
          Each user No No No No No No No No No No No Yes
          Blog No No No No No No No No No No No Yes
          Q & A No No No No No No No No No No No All posts

          Note: Yes means both the original post, and the reply to it

      12. Delete all of the messages in your mail client/catcher
      13. Show the course again

      B4) Hidden course category

      1. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      2. Open the course category of the course that the forums are all in
      3. From the settings menu, choose "Manage this category"
      4. Hide the course category (using the "Eye" icon)
      5. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      6. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      7. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No Yes No
          Standard No No No No No No No No No No Yes No
          Single Simple Discussion No No No No No No No No No No Yes No
          Each user No No No No No No No No No No Yes No
          Blog No No No No No No No No No No Yes No
          Q & A No No No No No No No No No No All posts No

          Note: Yes means both the original post, and the reply to it

      8. Delete all of the messages in your mail client/catcher
      9. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      10. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      11. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No No Yes
          Standard No No No No No No No No No No No Yes
          Single Simple Discussion No No No No No No No No No No No Yes
          Each user No No No No No No No No No No No Yes
          Blog No No No No No No No No No No No Yes
          Q & A No No No No No No No No No No No All posts

          Note: Yes means both the original post, and the reply to it

      12. Delete all of the messages in your mail client/catcher
      13. Show the course category again

      B5) Hidden course after initial send

      1. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      2. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      3. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      4. Open the course that the forums are all in
      5. From the settings menu, choose "Edit settings"
      6. Update the course visility to "Hide"
      7. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      8. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No Yes No
          Standard No No No No No No No No No No Yes No
          Single Simple Discussion No No No No No No No No No No Yes No
          Each user No No No No No No No No No No Yes No
          Blog No No No No No No No No No No Yes No
          Q & A No No No No No No No No No No All posts No

          Note: Yes means both the original post, and the reply to it

      9. Delete all of the messages in your mail client/catcher
      10. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      11. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      12. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No No Yes
          Standard No No No No No No No No No No No Yes
          Single Simple Discussion No No No No No No No No No No No Yes
          Each user No No No No No No No No No No No Yes
          Blog No No No No No No No No No No No Yes
          Q & A No No No No No No No No No No No All posts

          Note: Yes means both the original post, and the reply to it

      13. Delete all of the messages in your mail client/catcher
      14. Show the course again

      B6) Hidden forums

      1. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      2. Open the course that the forums are all in
      3. From the settings menu, choose "Turn editing on"
      4. Hide all of the forums
      5. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      6. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      7. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      8. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No Yes No
          Standard No No No No No No No No No No Yes No
          Single Simple Discussion No No No No No No No No No No Yes No
          Each user No No No No No No No No No No Yes No
          Blog No No No No No No No No No No Yes No
          Q & A No No No No No No No No No No All posts No

          Note: Yes means both the original post, and the reply to it

      9. Delete all of the messages in your mail client/catcher
      10. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      11. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      12. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Announcement No No No No No No No No No No No Yes
          Standard No No No No No No No No No No No Yes
          Single Simple Discussion No No No No No No No No No No No Yes
          Each user No No No No No No No No No No No Yes
          Blog No No No No No No No No No No No Yes
          Q & A No No No No No No No No No No No All posts

          Note: Yes means both the original post, and the reply to it

      13. Delete all of the messages in your mail client/catcher
      14. Show the forums again

      C) Discussion subscriptions

      1. Login as users s1, s2, s3
        1. Open up the "Standard" forum
        2. Unsubscribe from the discussion you created initially (Click the envelope icon so that it shows an open envelope)
      2. Login as user s10
        1. Open up the "Standard" forum
        2. Subscribe to the discussion you created initially (Click the envelope icon so that it shows a closed envelope)
      3. Login as admin
        1. Create a new reply to that discussion
      4. Wait 1 minute
      5. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      6. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      7. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s10
          Standard No No No Yes

          Note: Ignore messages from the other users.

      8. Delete all of the messages in your mail client/catcher
      9. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      10. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      11. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s10
          Standard No No No No
      12. Delete all of the messages in your mail client/catcher
      13. Login as s10
      14. Open your Forum preferences (User menu -> Preferences -> Forum preferences)
      15. Set "Digest type" to complete
      16. Login as admin
      17. Post another reply to the discussion (set the "Send forum post notifications with no editing-time delay" checkbox)
      18. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      19. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      20. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s10
          Standard No No No No

          Note: Ignore messages from the other users.

      21. Delete all of the messages in your mail client/catcher
      22. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      23. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      24. Open the Mail client/catcher
        1. Confirm that you have the digests for the following users which contain posts:
          User: s1 s2 s3 s10
          Standard No No No Yes
      25. Delete all of the messages in your mail client/catcher
      26. Login as s10
      27. Reset your digest preferences back to "No digests"

      D) Timed forum posts

      1. Login as admin
      2. Open the standard forum
      3. Create a new forum post:
        1. Set "Send forum post notifications with no editing-time delay"
        2. Expand "Display period"
        3. Choose a "Display start" time of three minutes time
        4. Do not choose a "Display end" time
      4. Create a new forum post:
        1. Set "Send forum post notifications with no editing-time delay"
        2. Expand "Display period"
        3. Choose a "Display end" time of three minutes time
        4. Do not choose a "Display start" time
      5. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      6. Make a cup of tea
      7. By the time you've made your tea, the time you chose in the previous steps should have expired.
      8. Refresh the list of discussion:
        1. The one which was set to start in the future is now visible (text is not greyed out)
        2. The one which was set to end in the future is now hidden (text is greyed out)
      9. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      10. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      11. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Standard No No No No No No No No No No Yes Yes
      12. Delete all of the messages in your mail client/catcher
      13. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      14. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      15. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      16. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Standard Yes Yes (in digest) Yes (in digest) Yes Yes (in digest) Yes (in digest) Yes Yes (in digest) Yes (in digest) No Yes Yes (in digest)
      17. Delete all of the messages in your mail client/catcher

      E) Content removed between runs

      1. Login as admin
      2. Open the standard forum
      3. Create a new forum post:
        1. Set "Send forum post notifications with no editing-time delay"
      4. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

        1. Confirm there were no errors or failures
      5. Delete the forum post (Open the discussion, choose Delete, Confirm)
      6. Run the attached test_46881_adhoc.php script:

        php test_46881_adhoc.php
        

      7. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      8. Open the Mail client/catcher
        1. Confirm that you have the following:
          User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2
          Standard No No No No No No No No No No No No
      9. Delete all of the messages in your mail client/catcher

      F) Read tracking

      F1) Mark as read on post

      1. Login as s1
      2. Open your forum preferences
      3. Set "Forum tracking" to "Yes: highlight new posts for me"
      4. Set "When sending forum post notifications" to "Mark the post as read"
      5. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      6. View the Standard forum (as s1)
        1. Confirm that all posts appear as unread
      7. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

      8. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      9. View the Standard forum (as s1)
        1. Confirm that all posts appear as read

      F2) Do not mark as read on post

      1. Login as s1
      2. Open your forum preferences
      3. Set "Forum tracking" to "Yes: highlight new posts for me"
      4. Set "When sending forum post notifications" to "Do not mark the post as read"
      5. Run the attached test_46881_reset.php script

        php test_46881_adhoc.php
        

      6. View the Standard forum (as s1)
        1. Confirm that all posts appear as unread
      7. Run the scheduled task:

        php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task"
        

      8. Run the adhoc task runner:

        php admin/tool/task/cli/adhoc_task.php --execute
        

      9. View the Standard forum (as s1)
        1. Confirm that all posts still appear as unread
      Show
      A) Setup Start with a clean install of Moodle Ensure you have something like mailcatcher or MailHog running and configured Run the adhoc task processor to clear any pending adhoc tasks php admin/tool/task/cli/adhoc_task.php --execute Open Site administration and search for 'maxediting' Set the max editing time to 1 minute Create one new course Enrol 10 students (s1-s10), and two editing teachers (t1, t2) in the course Ensure that the "Activities" block is present in the course Ensure that each course has the "Announcements" forum Create forums for each of the other types. Ensure that you set the Subscription to 'Automatic': Standard Blog Question and Answer Each User Single simple discussion For each of the remaining students login and ensure the following are set: Note: To set the profile setting, open the user menu -> Preferences -> Forum preferences, and use the dropdown Note: To set the setting for all forums, follow the "Forum" link in the Activities block and use the toggle for each of the forums User Profile setting Setting for all forums s1 No digest (no change) Default (No digest) s2 No digest (no change) Complete digest s3 No digest (no change) Subjects only s4 Complete digest No digest s5 Complete digest Default (Complete) s6 Complete digest Subjects only s7 Subjects only digest No digest s8 Subjects only digest Complete s9 Subjects only digest Default (Subjects only) t1 No digest (no change) Default (No digest) t2 Complete digest Default (Complete) Login as s10 Navigate to the course and select "Forum" in the activies block Unsubscribe from each forum (Note: You cannot unsubscribe from the News forum) Login as admin Start a new discussion in each of: Announcements Standard Q&A Each User Blog (Add a new topic) Note: for ease of testing I suggest you set a subject which includes the type of forum. Reply to a post in all of them (including the Single simple discussion) Note: For Blog you must "Discuss this topic" Wait 1 minute B) Visibility tests B1) Initial test (all forums visible) Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement Yes No No Yes No No Yes No No Yes Yes No Standard Yes No No Yes No No Yes No No No Yes No Single Simple Discussion Yes No No Yes No No Yes No No No Yes No Each user Yes No No Yes No No Yes No No No Yes No Blog Yes No No Yes No No Yes No No No Yes No Q & A First only No No First only No No First only No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Standard No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Single Simple Discussion No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Each user No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Blog No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Q & A No First only First only (Subject only) No First only First only (Subject only) No First only First only (Subject only) No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher B2) Initially hidden, but made visible before send Run the attached test_46881_reset.php script php test_46881_adhoc.php Open the course that the forums are all in From the settings menu, choose "Edit settings" Update the course visility to "Hide" Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Open the course that the forums are all in From the settings menu, choose "Edit settings" Update the course visility to "Show" Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement Yes No No Yes No No Yes No No Yes Yes No Standard Yes No No Yes No No Yes No No No Yes No Single Simple Discussion Yes No No Yes No No Yes No No No Yes No Each user Yes No No Yes No No Yes No No No Yes No Blog Yes No No Yes No No Yes No No No Yes No Q & A First only No No First only No No First only No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Standard No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Single Simple Discussion No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Each user No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Blog No Yes Yes (Subject only) No Yes Yes (Subject only) No Yes Yes (Subject only) No No Yes Q & A No First only First only (Subject only) No First only First only (Subject only) No First only First only (Subject only) No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher B3) Hidden course Run the attached test_46881_reset.php script php test_46881_adhoc.php Open the course that the forums are all in From the settings menu, choose "Edit settings" Update the course visility to "Hide" Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No Yes No Standard No No No No No No No No No No Yes No Single Simple Discussion No No No No No No No No No No Yes No Each user No No No No No No No No No No Yes No Blog No No No No No No No No No No Yes No Q & A No No No No No No No No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No No Yes Standard No No No No No No No No No No No Yes Single Simple Discussion No No No No No No No No No No No Yes Each user No No No No No No No No No No No Yes Blog No No No No No No No No No No No Yes Q & A No No No No No No No No No No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Show the course again B4) Hidden course category Run the attached test_46881_reset.php script php test_46881_adhoc.php Open the course category of the course that the forums are all in From the settings menu, choose "Manage this category" Hide the course category (using the "Eye" icon) Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No Yes No Standard No No No No No No No No No No Yes No Single Simple Discussion No No No No No No No No No No Yes No Each user No No No No No No No No No No Yes No Blog No No No No No No No No No No Yes No Q & A No No No No No No No No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No No Yes Standard No No No No No No No No No No No Yes Single Simple Discussion No No No No No No No No No No No Yes Each user No No No No No No No No No No No Yes Blog No No No No No No No No No No No Yes Q & A No No No No No No No No No No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Show the course category again B5) Hidden course after initial send Run the attached test_46881_reset.php script php test_46881_adhoc.php Run the attached test_46881_reset.php script php test_46881_adhoc.php Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Open the course that the forums are all in From the settings menu, choose "Edit settings" Update the course visility to "Hide" Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No Yes No Standard No No No No No No No No No No Yes No Single Simple Discussion No No No No No No No No No No Yes No Each user No No No No No No No No No No Yes No Blog No No No No No No No No No No Yes No Q & A No No No No No No No No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No No Yes Standard No No No No No No No No No No No Yes Single Simple Discussion No No No No No No No No No No No Yes Each user No No No No No No No No No No No Yes Blog No No No No No No No No No No No Yes Q & A No No No No No No No No No No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Show the course again B6) Hidden forums Run the attached test_46881_reset.php script php test_46881_adhoc.php Open the course that the forums are all in From the settings menu, choose "Turn editing on" Hide all of the forums Run the attached test_46881_reset.php script php test_46881_adhoc.php Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No Yes No Standard No No No No No No No No No No Yes No Single Simple Discussion No No No No No No No No No No Yes No Each user No No No No No No No No No No Yes No Blog No No No No No No No No No No Yes No Q & A No No No No No No No No No No All posts No Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Announcement No No No No No No No No No No No Yes Standard No No No No No No No No No No No Yes Single Simple Discussion No No No No No No No No No No No Yes Each user No No No No No No No No No No No Yes Blog No No No No No No No No No No No Yes Q & A No No No No No No No No No No No All posts Note: Yes means both the original post, and the reply to it Delete all of the messages in your mail client/catcher Show the forums again C) Discussion subscriptions Login as users s1, s2, s3 Open up the "Standard" forum Unsubscribe from the discussion you created initially (Click the envelope icon so that it shows an open envelope) Login as user s10 Open up the "Standard" forum Subscribe to the discussion you created initially (Click the envelope icon so that it shows a closed envelope) Login as admin Create a new reply to that discussion Wait 1 minute Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s10 Standard No No No Yes Note: Ignore messages from the other users. Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s10 Standard No No No No Delete all of the messages in your mail client/catcher Login as s10 Open your Forum preferences (User menu -> Preferences -> Forum preferences) Set "Digest type" to complete Login as admin Post another reply to the discussion (set the "Send forum post notifications with no editing-time delay" checkbox) Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s10 Standard No No No No Note: Ignore messages from the other users. Delete all of the messages in your mail client/catcher Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the digests for the following users which contain posts: User: s1 s2 s3 s10 Standard No No No Yes Delete all of the messages in your mail client/catcher Login as s10 Reset your digest preferences back to "No digests" D) Timed forum posts Login as admin Open the standard forum Create a new forum post: Set "Send forum post notifications with no editing-time delay" Expand "Display period" Choose a "Display start" time of three minutes time Do not choose a "Display end" time Create a new forum post: Set "Send forum post notifications with no editing-time delay" Expand "Display period" Choose a "Display end" time of three minutes time Do not choose a "Display start" time Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Make a cup of tea By the time you've made your tea, the time you chose in the previous steps should have expired. Refresh the list of discussion: The one which was set to start in the future is now visible (text is not greyed out) The one which was set to end in the future is now hidden (text is greyed out) Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Standard No No No No No No No No No No Yes Yes Delete all of the messages in your mail client/catcher Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Standard Yes Yes (in digest) Yes (in digest) Yes Yes (in digest) Yes (in digest) Yes Yes (in digest) Yes (in digest) No Yes Yes (in digest) Delete all of the messages in your mail client/catcher E) Content removed between runs Login as admin Open the standard forum Create a new forum post: Set "Send forum post notifications with no editing-time delay" Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Confirm there were no errors or failures Delete the forum post (Open the discussion, choose Delete, Confirm) Run the attached test_46881_adhoc.php script: php test_46881_adhoc.php Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute Open the Mail client/catcher Confirm that you have the following: User: s1 s2 s3 s4 s5 s6 s7 s8 s9 s10 t1 t2 Standard No No No No No No No No No No No No Delete all of the messages in your mail client/catcher F) Read tracking F1) Mark as read on post Login as s1 Open your forum preferences Set "Forum tracking" to "Yes: highlight new posts for me" Set "When sending forum post notifications" to "Mark the post as read" Run the attached test_46881_reset.php script php test_46881_adhoc.php View the Standard forum (as s1) Confirm that all posts appear as unread Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute View the Standard forum (as s1) Confirm that all posts appear as read F2) Do not mark as read on post Login as s1 Open your forum preferences Set "Forum tracking" to "Yes: highlight new posts for me" Set "When sending forum post notifications" to "Do not mark the post as read" Run the attached test_46881_reset.php script php test_46881_adhoc.php View the Standard forum (as s1) Confirm that all posts appear as unread Run the scheduled task: php admin/tool/task/cli/scheduled_task.php --execute="\mod_forum\task\cron_task" Run the adhoc task runner: php admin/tool/task/cli/adhoc_task.php --execute View the Standard forum (as s1) Confirm that all posts still appear as unread
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_30_STABLE, MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull Master Branch:
      MDL-46881-master

      Description

      It's most likely possible to refactor the cron tasks into smaller chunks to handle single, digests etc ...

        Attachments

        1. B1_1.PNG
          B1_1.PNG
          390 kB
        2. B1_2.PNG
          B1_2.PNG
          313 kB
        3. B1_3.PNG
          B1_3.PNG
          358 kB
        4. B1_4.PNG
          B1_4.PNG
          285 kB
        5. b2_1.PNG
          b2_1.PNG
          365 kB
        6. b2_2.PNG
          b2_2.PNG
          554 kB
        7. b2_3.PNG
          b2_3.PNG
          183 kB
        8. B3.PNG
          B3.PNG
          212 kB
        9. b4.PNG
          b4.PNG
          240 kB
        10. b5&b6.PNG
          b5&b6.PNG
          465 kB
        11. c.PNG
          c.PNG
          287 kB
        12. d.PNG
          d.PNG
          271 kB
        13. E&F.PNG
          E&F.PNG
          338 kB
        14. test_46881_adhoc.php
          0.2 kB
        15. test_46881_reset.php
          0.4 kB

          Issue Links

            Activity

              People

              • Votes:
                10 Vote for this issue
                Watchers:
                22 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  20/May/19

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 3 hours
                  3h