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

Deprecate dupe cron_run_single_task() function

XMLWordPrintable

    • MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • MDL-63580-master
    • Hide

      Setup

      1. Put into your local directory the attached test file test_cron_run_single_task.php (This script execute \mod_forum\task\cron_task using the deprecated function cron_run_single_task).
      2. Log in as an admin
      3. Go to Site administration / Server / System paths
      4. Set "Path to PHP CLI" to the path to your PHP executable.
        1. On Linux, you can use the value returned by the command "which php" on your terminal.
        2. On Windows, you can use the value returned by the command "where php" on your terminal.
      5. Enable the debugging mode in Site administration / Development / Debugging 
        1. Set debug to 'DEVELOPER: extra Moodle debug messages for developers' value.

      Testing Scenario 1: Test cron_run_single_task is deprecated.

      1. Log in as an admin
      2. Go to this URL in your browser: http://MOODLESITE/local/test_cron_run_single_task.php
      3. Expected result: Check you can see this message:

      cron_run_single_task() is deprecated. Please use \tool_task\run_from_cli::execute() instead.
       
          line 3326 of /lib/deprecatedlib.php: call to debugging()
          line 11 of /local/test_cron_run_single_task.php: call to cron_run_single_task()
       
      Execute scheduled task: Forum mailings and maintenance jobs ...
      

      Testing Scenario 2: Run schedule task from Scheduled Tasks manager

      1. Log in as an admin
      1. Go to Site administration / Server / Tasks / Scheduled tasks
      2. Click "Run now" for the "Forum mailings and maintenance jobs" task ('\mod_forum\task\cron_task').
      3. Expected result: 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.)

      Testing Scenario 3: Check CLI script schedule_task.php in admin/cli works fine.

      1. Run the next command in your console from your root Moodle installation.

        php admin/cli/scheduled_task.php
        

      2. Expected result: Confirm that you could see the help.
      3. Run the next command in your console. Be sure, you are in the Path on your Moodle installation.

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

      4. Expected result: 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.)
      5. Run the next command in your console from your root Moodle installation.

        php admin/cli/scheduled_task.php --list
        

      6. Expected result: Confirm that the script executes successfully listing all the scheduled tasks.

      Testing Scenario 4: Check CLI script schedule_task.php in admin/tool/task/cli works fine and show a deprecated message.

      1. Run the next command in your console. Be sure, you are in the Path on your Moodle installation.

        php admin/tool/task/cli/schedule_task.php --execute='\mod_forum\task\cron_task'
        

      2. Expected result: 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.) and show the next debugging message on the top:

        ++ admin/tool/task/cli/schedule_task.php is deprecated. Please use admin/cli/schedule_task.php instead. ++
        * line 39 of /admin/tool/task/cli/schedule_task.php: call to debugging()
        

      Testing Scenario 5: Check CLI script adhoc_task.php in admin/cli works fine.

      1. Run the next command in your console. Be sure, you are in the root folder on your Moodle installation.

        php admin/cli/adhoc_task.php
        

      2. Expected result: Confirm that you could see the help.
      3. Run attached testadhoc_task.php script to queue a new adhoc task.
      4. Run the next command in your console. Be sure, you are in theroot folder on your Moodle installation.

        php admin/cli/adhoc_task.php --execute
        

      5. Expected result: Confirm that the task executes successfully without any errors.
      6. Run attached testadhoc_task.php script to queue a new adhoc task.
      7. Run the next command in your console. Be sure, you are in the root folder on your Moodle installation.

        php admin/cli/adhoc_task.php --execute --showsql --showdebugging
        

      8. Expected result: Confirm that the task executes successfully without any errors and with SQL and debugging output.

      Testing Scenario 6: Check CLI script adhoc_task.php in admin/tool/task/cli works fine.

      1. Run attached testadhoc_task.php script to queue a new adhoc task.
      2. Run the next command in your console. Be sure, you are in the Path on your Moodle installation.

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

      3. Expected result: Confirm that the task executes successfully without any errors and show a deprecated message on the top:

        ++ admin/tool/task/cli/adhoc_task.php is deprecated. Please use admin/cli/adhoc_task.php instead. ++
        * line 50 of /admin/tool/task/cli/adhoc_task.php: call to debugging()

      Testing Scenario 7: Check the H5P overview show 'Run now' in the H5P scheduled task

      1. Login as an admin.
      2. Go to Site administration/H5P/H5P overview
      3. Expected result: Confirm you can see 'Run now' below the Status in the feature H5P scheduled task.
      Show
      Setup Put into your local directory the attached test file  test_cron_run_single_task.php  (This script execute \mod_forum\task\cron_task using the deprecated function cron_run_single_task). 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. Enable the debugging mode in Site administration / Development / Debugging   Set debug to ' DEVELOPER: extra Moodle debug messages for developers' value. Testing Scenario 1: Test cron_run_single_task is deprecated. Log in as an admin Go to this URL in your browser: http://MOODLESITE/local/test_cron_run_single_task.php Expected result: Check you can see this message: cron_run_single_task() is deprecated. Please use \tool_task\run_from_cli::execute() instead.   line 3326 of /lib/deprecatedlib.php: call to debugging() line 11 of /local/test_cron_run_single_task.php: call to cron_run_single_task()   Execute scheduled task: Forum mailings and maintenance jobs ... Testing Scenario 2: Run schedule task from Scheduled Tasks manager Log in as an admin Go to Site administration / Server / Tasks / Scheduled tasks Click " Run now " for the " Forum mailings and maintenance jobs " task ('\mod_forum\task\cron_task'). Expected result: 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.) Testing Scenario 3: Check CLI script schedule_task.php in admin/cli works fine. Run the next command in your console from your root Moodle installation. php admin/cli/scheduled_task.php Expected result: Confirm that you could see the help. Run the next command in your console. Be sure, you are in the Path on your Moodle installation. php admin/cli/scheduled_task.php --execute='\mod_forum\task\cron_task' Expected result: 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.) Run the next command in your console from your root Moodle installation. php admin/cli/scheduled_task.php --list Expected result: Confirm that the script executes successfully listing all the scheduled tasks. Testing Scenario 4: Check CLI script schedule_task.php in admin/tool/task/cli works fine and show a deprecated message. Run the next command in your console. Be sure, you are in the Path on your Moodle installation. php admin/tool/task/cli/schedule_task.php --execute='\mod_forum\task\cron_task' Expected result: 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.) and show the next debugging message on the top: ++ admin/tool/task/cli/schedule_task.php is deprecated. Please use admin/cli/schedule_task.php instead. ++ * line 39 of /admin/tool/task/cli/schedule_task.php: call to debugging() Testing Scenario 5: Check CLI script adhoc_task.php in admin/cli works fine. Run the next command in your console. Be sure, you are in the root folder on your Moodle installation. php admin/cli/adhoc_task.php Expected result: Confirm that you could see the help. Run attached testadhoc_task.php script to queue a new adhoc task. Run the next command in your console. Be sure, you are in theroot folder on your Moodle installation. php admin/cli/adhoc_task.php --execute Expected result: Confirm that the task executes successfully without any errors. Run attached testadhoc_task.php script to queue a new adhoc task. Run the next command in your console. Be sure, you are in the root folder on your Moodle installation. php admin/cli/adhoc_task.php --execute --showsql --showdebugging Expected result: Confirm that the task executes successfully without any errors and with SQL and debugging output. Testing Scenario 6: Check CLI script adhoc_task.php in admin/tool/task/cli works fine. Run attached testadhoc_task.php script to queue a new adhoc task. Run the next command in your console. Be sure, you are in the Path on your Moodle installation. php admin/tool/task/cli/adhoc_task.php --execute Expected result: Confirm that the task executes successfully without any errors and show a deprecated message on the top: ++ admin/tool/task/cli/adhoc_task.php is deprecated. Please use admin/cli/adhoc_task.php instead. ++ * line 50 of /admin/tool/task/cli/adhoc_task.php: call to debugging() Testing Scenario 7: Check the H5P overview show 'Run now' in the H5P scheduled task Login as an admin. Go to Site administration/H5P/H5P overview Expected result: Confirm you can see 'Run now' below the Status in the feature H5P scheduled task .
    • 3
    • Moppies Moodle 3.8 Sprint 1, Moppies Moodle 3.8 Sprint 2, Moppies Moodle 3.8 Sprint 3, Moppies Moodle 3.8 Sprint 4, Moppies Kanban

      Working on MDL-60514 we created a new class that does cron_run_single_task() never used again in the core.

        1. testadhoc_task.php
          0.1 kB
        2. test_cron_run_single_task.php
          0.3 kB
        3. Screenshot_3.png
          Screenshot_3.png
          90 kB
        4. Screenshot_2.png
          Screenshot_2.png
          223 kB
        5. Screenshot_1.png
          Screenshot_1.png
          346 kB

            cescobedo Carlos Escobedo
            tonibarbera Toni Barberà
            Victor Déniz Falcón Victor Déniz Falcón
            Jun Pataleta Jun Pataleta
            Janelle Barcega Janelle Barcega
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 6 hours, 55 minutes
                1d 6h 55m

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