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

    • MOODLE_37_STABLE
    • MOODLE_37_STABLE
    • MDL-66279-master
    • 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"

    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

        1. MDL-66279.jpg
          83 kB
          Anna Carissa Sadia

        Activity

          People

            cameron1729 cameron1729
            cameron1729 cameron1729
            Mathew May Mathew May
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              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