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

    • 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"

      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.

            cameron1729 cameron1729
            cameron1729 cameron1729
            Glyn (Mathew) May Glyn (Mathew) May
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

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

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