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

task_log_cleanup_task.php is hardcoded to use the database_logger cleanup method

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      On a fresh install:

      1. Install the attached sillylogger local plugin
      2. Add to config.php:

        $CFG->task_log_class = '\\local_sillylogger\\silly_logger';

      3. Navigate to "Site administration" > "Server" > "Tasks" and set the following:
        1. task_logretention: 1 second
        2. task_logretainruns: 1
      4. Run cron:

        php admin/cli/cron.php
        

        • Verify you see "Hello from the silly logger" in the output
      5. Run the cleanup task:

        php admin/tool/task/cli/schedule_task.php --execute="\\core\\task\\task_log_cleanup_task"
        

        • Verify you see "This is the silly logger cleaning up after itself"
      Show
      On a fresh install: Install the attached sillylogger local plugin Add to config.php: $CFG->task_log_class = '\\local_sillylogger\\silly_logger'; Navigate to "Site administration" > "Server" > "Tasks" and set the following: task_logretention: 1 second task_logretainruns: 1 Run cron: php admin/cli/cron.php Verify you see "Hello from the silly logger" in the output Run the cleanup task: php admin/tool/task/cli/schedule_task.php --execute="\\core\\task\\task_log_cleanup_task" Verify you see "This is the silly logger cleaning up after itself"
    • Affected Branches:
      MOODLE_37_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE
    • Pull from Repository:
    • Pull 3.7 Branch:
    • Pull Master Branch:
      MDL-66279-master

      Description

      lib/classes/task/task_log_cleanup_task.php only executes the cleanup method from the core database_logger. If someone specifies their own logger class, extended from the database_logger, then the cleanup method never gets called. Using is_a and $classname::cleanup would allow extended classes to either overwrite the default implementation, or just have the default one used.

        Attachments

          Activity

            People

            • Assignee:
              cameron1729 cameron1729
              Reporter:
              cameron1729 cameron1729
              Peer reviewer:
              Mathew May
              Integrator:
              Andrew Nicols
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Andrew Nicols, Mathew May, Michael Hawkins, Shamim Rezaie, Simey Lameze
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                9/Sep/19

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 35 minutes
                6h 35m