-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
4.3
Moodle 4.3.3 (20240212) on Debian 12 / Apache 2.4.57 / libapache2-mod-xsendfile 0.12-2 and config.php with:
$CFG->xsendfile = 'X-Sendfile'; |
$CFG->localrequestdir = $CFG->dataroot . '/temp/localrequestdir'; |
- In a course, create a database activity and add two fields, one «text» and one «file»
- Add a new entry and upload a file
- Go to "Actions"->"Export entries", check «Include files in export» and click «Export entries»
- Confirm
- empty tab - no file downloaded
- error in PHP logs:
[Mon Mar 18 10:48:06.722110 2024] [:error] [pid xxxxxxx] (2)No such file or directory: [client ip:port] xsendfile: cannot open file: /var/www/xxxxxxxxxxxx/moodledata/temp/localrequestdir/jd2a/65f80dd6aec96/65f80dd6aee18/Exportfile.zip, referer: https://xxxxxxxxxxxxxxxxxxxx/mod/data/export.php?d=1&backto=https%3A%2F%2Fxxxxxxxxxxxxxxxxx%2Fmod%2Fdata%2Fview.php%3Fd%3D1
- In mod/data/classes/local/exporter/entries_exporter.php in function create_zip_archive, replace
$tmpdir = make_request_directory();
with$tmpdir = make_temp_directory(uniqid('test'));
- Confirm that database export worked as expected
If I understand correctly, make_request_directory create a directory which die with it's content at end of PHP request (\core_shutdown_manager::register_function('remove_dir', [$dir]);), so, Apache/X-Sendfile haven't time to get the file
If correct, it's not specific to database activity, it could happen each time make_request_directory is used to download a file