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

Check manager incorrectly instantiates plugin supplied performance checks

    XMLWordPrintable

Details

    • MOODLE_310_STABLE, MOODLE_311_STABLE, MOODLE_400_STABLE
    • MOODLE_310_STABLE, MOODLE_311_STABLE
    • MDL-72924-fix-component-initialisation-for-performance-checks-MOODLE_311_STABLE
    • MDL-72924-fix-component-initialisation-for-performance-checks
    • Hide

      1) Update an existing status check, to the type of performance located here: /admin/tool/task/lib.php which is demonstrated in the diff below.

      (This changes part of the function name from status to performance)

      -function tool_task_status_checks() : array {
      +function tool_task_performance_checks() : array {

      2) Purge the caches

      3) Go to /report/performance/index.php and confirm you do not see any errors

      4) Confirm you do see the 'Cron running' check in the table (it's status doesn't matter).

       

      Show
      1)  Update an existing status check, to the type of performance located here: /admin/tool/task/lib.php which is demonstrated in the diff below. (This changes part of the function name from status to performance) -function tool_task_status_checks() : array { +function tool_task_performance_checks() : array { 2) Purge the caches 3) Go to /report/performance/index.php and confirm you do not see any errors 4) Confirm you do see the 'Cron running' check in the table (it's status doesn't matter).  

    Description

      Attempting to define a third party performance check in a plugin leads to a coding error when attempting to view the Performance check report.

       

      Exception - Cannot access protected property tool_xxx\check\enabled::$component

      Stack trace:

      • line 82 of /lib/classes/check/manager.php: Error thrown
      • line 56 of /lib/classes/check/manager.php: call to core\check\manager::get_performance_checks()
      • line 72 of /lib/classes/check/table.php: call to core\check\manager::get_checks()
      • line 35 of /report/performance/index.php: call to core\check\table->__construct()

       

      The manager attempts to directly set $check->component, whereas it is correctly accessed using the set_component() method for status and security checks

      Attachments

        1. MDL-72924_v311.png
          MDL-72924_v311.png
          130 kB
        2. MDL-72924_v310.png
          MDL-72924_v310.png
          130 kB
        3. MDL-72924_master.png
          MDL-72924_master.png
          148 kB

        Activity

          People

            kevinpham Kevin Pham
            peterburnett Peter Burnett
            Brendan Heywood Brendan Heywood
            Shamim Rezaie Shamim Rezaie
            Angelia Dela Cruz Angelia Dela Cruz
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              8/Nov/21

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m