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

Task API does not setup OUTPUT API properly

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test on UI
      1. Go to "Site administration / Server / Scheduled tasks"
      2. Click "Run now" on any scheduled task listed.
      3. Confirm that you don't get any errors.
      Test on CLI Cron
      1. Install the attached moodle-local_adhoctest.zip plugin.
      2. Run cron:

        php admin/cli/cron.php
        

      3. Confirm that you don't get any errors.
      4. Run the test plugin's prepare script:

        php local/adhoctest/prepare.php

      5. Run cron again:

        php admin/cli/cron.php

      6. Confirm that the the action_link's data is properly being exported and that you don't encounter any errors.
      Test on Web Cron
      1. access http://path/to/site/admin/cron.php
        1. Access http://path/to/site/admin/cron.php in your browser
      2. Run the test plugin's prepare script:
        php local/adhoctest/prepare.php
      3. Run cron again:
        1. Access http://path/to/site/admin/cron.php in your browser
        2. Confirm that the the action_link's data is properly being exported and that you don't encounter any errors.
      Show
      Test on UI Go to " Site administration / Server / Scheduled tasks " Click " Run now " on any scheduled task listed. Confirm that you don't get any errors. Test on CLI Cron Install the attached moodle-local_adhoctest.zip plugin. Run cron: php admin/cli/cron.php Confirm that you don't get any errors. Run the test plugin's prepare script: php local/adhoctest/prepare.php Run cron again: php admin/cli/cron.php Confirm that the the action_link's data is properly being exported and that you don't encounter any errors. Test on Web Cron access http://path/to/site/admin/cron.php Access http://path/to/site/admin/cron.php in your browser Run the test plugin's prepare script: php local/adhoctest/prepare.php Run cron again: Access http://path/to/site/admin/cron.php in your browser Confirm that the the action_link's data is properly being exported and that you don't encounter any errors.
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE, MOODLE_35_STABLE
    • Fixed Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-61800-master

      Description

      I noticed when writing a new an adhoc task runner that we do not setup the OUTPUT API properly between runs.

      At the moment, adhoc tasks (and probably scheduled tasks too) only have working output by virtue of other tasks setting up the adhoc task.

      1. Install the attached local plugin
      2. Run php local/adhoctest/prepare.php to queue an adhoc task
      3. Run php local/adhoctest/runadhoc.php

      The task should dump an action_link which has been rendered using a template and renderer.

      The runadhoc.php script is just a copy of admin/cli/cron.php and cronlib.php::cron_run() with the scheduled tasks part removed. No other changes have been made.

      However, the code does not set up any $OUTPUT, but somewhere along the line if I run the standard cron runner then OUTPUT is set up and this i used instead.

      I can replicate the same issue if I run:

      php admin/cli/cron.php ; php local/adhoctest/prepare.php ; php admin/cli/cron.php
      

      Note: You may have to run this a few times.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  17/May/18