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

Session write debugging message in report builder

XMLWordPrintable

    • MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-80735-402
    • MDL-80735-403
    • Hide

      This is a tiny patch with long testing instructions, sorry.

      Test 1. Custom reports.

      • Make sure all debugging is enabled
      • Create a custom report from the "Courses" datasource
      • Add any column (i.e. course name) and a filter "Select category"
      • Preview report, make sure filter works, actually apply a filter
      • Download report in any format, make sure the results are filtered
      • Make sure there are no debugging messages in the end of the downloaded file

      Test 2. System report (main only)

      This can not currently be reproduced on any existing system reports, so you need to make a small code change. This part does require testing in 403/402 branches

      diff --git a/admin/classes/reportbuilder/local/systemreports/users.php b/admin/classes/reportbuilder/local/systemreports/users.php
      index df6616079ed0f..8c6d7686b4dd5 100644
      --- a/admin/classes/reportbuilder/local/systemreports/users.php
      +++ b/admin/classes/reportbuilder/local/systemreports/users.php
      @@ -104,7 +104,7 @@ protected function initialise(): void {
               $this->add_actions();
       
               // Set if report can be downloaded.
      -        $this->set_downloadable(false);
      +        $this->set_downloadable(true);
           }
       
           /**
      

      1. Go to Site administration>Users>Browse list of users
      2. Make sure you can filter the report (i.e. by "course role" filter)
      3. Download report in any format
      4. Make sure there are no debugging messages in the end of the downloaded file

      Show
      This is a tiny patch with long testing instructions, sorry. Test 1. Custom reports. Make sure all debugging is enabled Create a custom report from the "Courses" datasource Add any column (i.e. course name) and a filter "Select category" Preview report, make sure filter works, actually apply a filter Download report in any format, make sure the results are filtered Make sure there are no debugging messages in the end of the downloaded file Test 2. System report (main only) This can not currently be reproduced on any existing system reports, so you need to make a small code change. This part does require testing in 403/402 branches diff --git a/admin/classes/reportbuilder/local/systemreports/users.php b/admin/classes/reportbuilder/local/systemreports/users.php index df6616079ed0f..8c6d7686b4dd5 100644 --- a/admin/classes/reportbuilder/local/systemreports/users.php +++ b/admin/classes/reportbuilder/local/systemreports/users.php @@ -104,7 +104,7 @@ protected function initialise(): void { $this->add_actions(); // Set if report can be downloaded. - $this->set_downloadable(false); + $this->set_downloadable(true); } /** 1. Go to Site administration>Users>Browse list of users 2. Make sure you can filter the report (i.e. by "course role" filter) 3. Download report in any format 4. Make sure there are no debugging messages in the end of the downloaded file
    • WP Sprint 2024-I1.1 (Clones)

      While trying to enable download for "Browse list of users" in MDL-80560 we discovered a problem with the session writing. I'm moving it into a separate issue (Bug) since this can be reproduced by creating a custom report with some filters.

      1. Create a custom report from the "Courses" datasource
      2. Add any column (i.e. course name) and a filter "Select category"
      3. Preview and download this report, you don't need to filter by anything
      4. You will get a debugging message in the end of the downloaded file (that actually completely breaks formats like PDF/CSV/XLS)

      Script /reportbuilder/download.php?sesskey=3AQay7e9Wt&download=html&id=43 mutated the session after it was closed: $SESSION->cachestore_session: default_session-core/coursecat,default_session-core/courseeditorstate,default_session-core/navigation_expandcourse
      line 791 of /lib/classes/session/manager.php: call to debugging()
      line 159 of /lib/classes/shutdown_manager.php: call to core\session\manager::check_mutated_closed_session()
      line ? of unknownfile: call to core_shutdown_manager::shutdown_handler()
      

      This happens because when we download, the session is closed BEFORE we initialise filters and some filters (especially this one) use session cache while populating the options. It is actually closed early on purpose, so that the long download would not lock the session. See more details in the comments on MDL-80560

        1. MDL-80735.png
          MDL-80735.png
          297 kB
        2. Test1.png
          Test1.png
          34 kB
        3. Test2.png
          Test2.png
          94 kB

            marina Marina Glancy
            marina Marina Glancy
            Odei Alba Odei Alba
            Paul Holden Paul Holden
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 5 hours, 20 minutes
                5h 20m

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