Project: moodle
Issue MDL-44874: Per-request temp directories
According to [the docs|http://docs.moodle.org/dev/Server_clustering_improvements_proposal#.24CFG-.3Etempdir]: "If any script tries to use temp files that were not created during current request it is a bug that needs to be fixed." Now in load balanced environment (without sticky sessions) with multiple web servers and local temp dirs defined on the web servers local file systems, there are at least two cases where files are used for more than the current request: - upload users via CSV - restoring course backups Trying to perform the above actions leads to errors and the inability to complete the actions unless the local tempidr "$CFG->tempdir" is removed from the configuration, losing the local tempdir functionality. This issue introduces a new function: {code} make_request_directory($exceptiononerror = true); {code} This can be used in the same way as make_temp_directory(), but it does *not* take a subdirectory as an argument. It always outputs the full path to the new directory, and ensures that it will be deleted after the request finishes.
Story points: 40