xAPI-vle / moodle-logstore_xapi

A Moodle plugin to send xAPI statements to an LRS using events in the Moodle logstore.
GNU General Public License v3.0
75 stars 85 forks source link

Logstore_xAPI interference with Ad-hoc database queries download report output as .CSV file #773

Closed jpbennett closed 11 months ago

jpbennett commented 3 years ago

Description We have been working to debug this issue on our moodle site, during which we have observed the following:

The timestamp is being turned into a filename in a function called report_customsql_temp_cvs_name in locallib.php, which is called from both the view.php and download.php files.

view.php is the report view, where you have the option to download the various types of reports. download.php is the PHP script that is supposed to return the file or display the error message.

The timestamp is the exact same when the function is called from view.php and download.php, but the filename that is created based on the timestamp is 5 hours different in the view.php instance than the download.php instance, even though it is the same function.

The .CSV file download function fails because of the difference in the timestamp.

We found the ultimate issue: Logstore xAPI. This plugin is autoloading a file that sets the timezone to 'Europe/London'. It is NOT EVEN ENABLED in the our Moodle site, as shown in the screenshot below from Site administration > Plugins > Logging > Manage log stores, but because of the way that Moodle builds the admin menu, the plugin's settings are getting loaded automatically.

Version Plugin 2018082100 on Moodle 3.5.14 (Build: 20200914)

Steps to reproduce the bug

  1. Install ad-hoc database queries plugin and setup ANY of the contributed reports from https://docs.moodle.org/35/en/ad-hoc_contributed_reports
  2. Run the report -- the results should be displayed on the screen
  3. At the bottom of the report page at the Download these results as : drop-down, select Comma separated values (.csv). then click the download button.

Expected behaviour

Actual behaviour Error -- unknown file type is generated

Server information MySQL 5.7.31

Client information

Additional information Worked with Tim Hunt -- the owner of the Ad-hoc database queries plugin to troubleshoot the issue on the assumption the problem was with his plugin. Analysis of error logs showed that it was the result of conflicting timezones.

Discovered logstore_xAPI asserted a conflicting timezone -- EVEN when the plugin was disabled.

When we uninstalled your plugin, normal function was restored to the Ad-hoc database queries plugin.

We would like to see the issue fixed, so we could use the xAPI logstore

davidpesce commented 11 months ago

resolved via #775