mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
Merge branch 'w31_MDL-40898_m26_openhandles' of https://github.com/skodak/moodle
This commit is contained in:
commit
857e3ecb6c
@ -715,6 +715,7 @@ class tool_uploadcourse_course {
|
||||
$this->error('errorwhilerestoringcourse', new lang_string('errorwhilerestoringthecourse', 'tool_uploadcourse'));
|
||||
}
|
||||
$rc->destroy();
|
||||
unset($rc); // File logging is a mess, we can only try to rely on gc to close handles.
|
||||
}
|
||||
|
||||
// Proceed with enrolment data.
|
||||
|
@ -44,6 +44,13 @@ class tool_uploadcourse_helper {
|
||||
*/
|
||||
public static function clean_restore_content() {
|
||||
global $CFG;
|
||||
|
||||
// There are some sloppy unclosed file handles in backup/restore code,
|
||||
// let's hope somebody unset all controllers before calling this
|
||||
// and destroy magic will close all remaining open file handles,
|
||||
// otherwise Windows will fail deleting the directory.
|
||||
gc_collect_cycles();
|
||||
|
||||
if (!empty($CFG->keeptempdirectoriesonbackup)) {
|
||||
$cache = cache::make('tool_uploadcourse', 'helper');
|
||||
$backupids = (array) $cache->get('backupids');
|
||||
|
@ -129,6 +129,7 @@ class tool_uploadcourse_helper_testcase extends advanced_testcase {
|
||||
$this->assertTrue(isset($result['backup_destination']));
|
||||
$c1backupfile = $result['backup_destination']->copy_content_to_temp();
|
||||
$bc->destroy();
|
||||
unset($bc); // File logging is a mess, we can only try to rely on gc to close handles.
|
||||
|
||||
// Creating backup file.
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $c2->id, backup::FORMAT_MOODLE,
|
||||
@ -138,6 +139,7 @@ class tool_uploadcourse_helper_testcase extends advanced_testcase {
|
||||
$this->assertTrue(isset($result['backup_destination']));
|
||||
$c2backupfile = $result['backup_destination']->copy_content_to_temp();
|
||||
$bc->destroy();
|
||||
unset($bc); // File logging is a mess, we can only try to rely on gc to close handles.
|
||||
|
||||
// Checking restore dir.
|
||||
$dir = tool_uploadcourse_helper::get_restore_content_dir($c1backupfile, null);
|
||||
|
Loading…
x
Reference in New Issue
Block a user