MDL-49399 core: Allow creation of a new per-request basedir
Shutdown handlers are processed in order. If something in a shutdown handler uses a file which is stored in a per-request directory, and another, unrelated, per-request directory was created before the handler started. then a fresh per-request directory will be required.
This commit is contained in:
@@ -89,8 +89,7 @@ class logmanager {
|
||||
}
|
||||
|
||||
// We register a shutdown handler to ensure that logs causing any failures are correctly disposed of.
|
||||
// Note: This must happen before the per-request directory is requested because the shutdown handler may delete
|
||||
// the logfile.
|
||||
// Note: This must happen before the per-request directory is requested because the shutdown handler deletes the logfile.
|
||||
if (!self::$tasklogregistered) {
|
||||
\core_shutdown_manager::register_function(function() {
|
||||
// These will only actually do anything if capturing is current active when the thread ended, which
|
||||
@@ -98,6 +97,9 @@ class logmanager {
|
||||
\core\task\logmanager::finalise_log(true);
|
||||
});
|
||||
|
||||
// Create a brand new per-request directory basedir.
|
||||
get_request_storage_directory(true, true);
|
||||
|
||||
self::$tasklogregistered = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user