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

Scheduled task mod_forum\task\cron_task fails when executed as "Run now"

XMLWordPrintable

    • MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • MOODLE_36_STABLE
    • MDL-60514-master-new-cron-execution
    • Hide

      Note: Test on Moodle running on Windows and Linux servers.

      1. Log in as an admin
      2. Go to Site administration / Server / System paths
      3. Set "Path to PHP CLI" to the path to your PHP executable.
        • On Linux, you can use the value returned by the command "which php" on your terminal.
        • On Windows, you can use the value returned by the command "where php" on your terminal.
      4. Go to Site administration / Server / Scheduled tasks.
      5. Confirm that there is a "Run now" button in most (if not all) of the tasks.
      6. Click "Run now" for the "Forum mailings and maintenance jobs" task.
      7. On the confirmation prompt, confirm to run the task.
      8. Confirm that the task executes successfully without any errors (except maybe when the outgoing email settings have not been properly configured and that Moodle can't send email messages. This is fine. The important thing is that the task executes okay.)
      9. Go back to the Scheduled tasks page.
      10. Open another browser tab and go to Site administration / Server / System paths
      11. Remove the value in "Path to PHP CLI".
      12. Back on the Scheduled tasks page, click on "Run now" in any of the tasks listed.
      13. On the confirmation prompt, confirm to run the task.
      14. Confirm that you get an error that the path to the PHP CLI can't be found.
      15. Click on "Continue"
      16. Confirm that you are redirected to the System paths page.
      17. Leave the Path to PHP CLI setting blank.
      18. Go back to the scheduled tasks page.
      19. Confirm that the "Run now" links are not shown in any of the scheduled tasks.
      Show
      Note: Test on Moodle running on Windows and Linux servers. Log in as an admin Go to Site administration / Server / System paths Set " Path to PHP CLI " to the path to your PHP executable. On Linux, you can use the value returned by the command " which php " on your terminal. On Windows, you can use the value returned by the command " where php " on your terminal. Go to Site administration / Server / Scheduled tasks. Confirm that there is a "Run now" button in most (if not all) of the tasks. Click " Run now " for the " Forum mailings and maintenance jobs " task. On the confirmation prompt, confirm to run the task. Confirm that the task executes successfully without any errors (except maybe when the outgoing email settings have not been properly configured and that Moodle can't send email messages. This is fine. The important thing is that the task executes okay.) Go back to the Scheduled tasks page. Open another browser tab and go to Site administration / Server / System paths Remove the value in " Path to PHP CLI ". Back on the Scheduled tasks page, click on " Run now " in any of the tasks listed. On the confirmation prompt, confirm to run the task. Confirm that you get an error that the path to the PHP CLI can't be found. Click on " Continue " Confirm that you are redirected to the System paths page. Leave the Path to PHP CLI setting blank. Go back to the scheduled tasks page. Confirm that the " Run now " links are not shown in any of the scheduled tasks.

      When executed as "Run now":

      Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
      ... started 13:58:56. Current memory use 9.4MB.
      ... used 3 dbqueries
      ... used 0.0015528202056885 seconds
      Scheduled task failed: Forum mailings and maintenance jobs (mod_forum\task\cron_task),Coding error detected, it must be fixed by a programmer: Function cron_setup_user() cannot be used in normal requests!
      Backtrace:
      * line 918 of /mod/forum/lib.php: call to cron_setup_user()
      * line 45 of /mod/forum/classes/task/cron_task.php: call to forum_cron()
      * line 104 of /lib/cronlib.php: call to mod_forum\task\cron_task->execute()
      * line 292 of /lib/cronlib.php: call to cron_run_inner_scheduled_task()
      * line 91 of /admin/tool/task/schedule_task.php: call to cron_run_single_task()
      

      When executed as part of cron in /admin/cron.php:

      Execute scheduled task: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
      ... started 14:00:50. Current memory use 8MB.
      Starting digest processing...
      Cleaned old digest records
      ... used 6 dbqueries
      ... used 0.0041258335113525 seconds
      Scheduled task complete: Forum mailings and maintenance jobs (mod_forum\task\cron_task)
      

      Tested on 3.4 and 3.3. There is no "Run now" for scheduled tasks on 3.2 so it's not applicable

        1. MDL-60514_LINUX.PNG
          142 kB
        2. MDL-60514_WINDOWS.JPG
          MDL-60514_WINDOWS.JPG
          67 kB
        3. php-cgi -qrr.png
          php-cgi -qrr.png
          19 kB

            tonibarbera Toni Barberà
            marina Marina Glancy
            David Carrillo David Carrillo
            Jun Pataleta Jun Pataleta
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            25 Vote for this issue
            Watchers:
            24 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h

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