Merge branch 'MDL-50063' of git://github.com/stronk7/moodle
This commit is contained in:
@@ -126,6 +126,9 @@ class category_bin extends base_bin {
|
||||
throw new \moodle_exception('Failed to backup activity prior to deletion.');
|
||||
}
|
||||
|
||||
// Have finished with the controller, let's destroy it, freeing mem and resources.
|
||||
$controller->destroy();
|
||||
|
||||
// Grab the filename.
|
||||
$file = $result['backup_destination'];
|
||||
if (!$file->get_contenthash()) {
|
||||
@@ -259,6 +262,9 @@ class category_bin extends base_bin {
|
||||
// Run the import.
|
||||
$controller->execute_plan();
|
||||
|
||||
// Have finished with the controller, let's destroy it, freeing mem and resources.
|
||||
$controller->destroy();
|
||||
|
||||
// Fire event.
|
||||
$event = \tool_recyclebin\event\category_bin_item_restored::create(array(
|
||||
'objectid' => $item->id,
|
||||
|
||||
@@ -130,6 +130,9 @@ class course_bin extends base_bin {
|
||||
throw new \moodle_exception('Failed to backup activity prior to deletion.');
|
||||
}
|
||||
|
||||
// Have finished with the controller, let's destroy it, freeing mem and resources.
|
||||
$controller->destroy();
|
||||
|
||||
// Grab the filename.
|
||||
$file = $result['backup_destination'];
|
||||
if (!$file->get_contenthash()) {
|
||||
@@ -246,6 +249,9 @@ class course_bin extends base_bin {
|
||||
// Run the import.
|
||||
$controller->execute_plan();
|
||||
|
||||
// Have finished with the controller, let's destroy it, freeing mem and resources.
|
||||
$controller->destroy();
|
||||
|
||||
// Fire event.
|
||||
$event = \tool_recyclebin\event\course_bin_item_restored::create(array(
|
||||
'objectid' => $item->id,
|
||||
|
||||
@@ -740,7 +740,6 @@ 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.
|
||||
|
||||
@@ -35,13 +35,6 @@ global $CFG;
|
||||
*/
|
||||
class tool_uploadcourse_course_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tidy up open files that may be left open.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
gc_collect_cycles();
|
||||
}
|
||||
|
||||
public function test_proceed_without_prepare() {
|
||||
$this->resetAfterTest(true);
|
||||
$mode = tool_uploadcourse_processor::MODE_CREATE_NEW;
|
||||
|
||||
@@ -129,7 +129,6 @@ 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,
|
||||
@@ -139,7 +138,6 @@ 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.
|
||||
|
||||
$oldcfg = isset($CFG->keeptempdirectoriesonbackup) ? $CFG->keeptempdirectoriesonbackup : false;
|
||||
$CFG->keeptempdirectoriesonbackup = true;
|
||||
|
||||
@@ -36,13 +36,6 @@ require_once($CFG->libdir . '/csvlib.class.php');
|
||||
*/
|
||||
class tool_uploadcourse_processor_testcase extends advanced_testcase {
|
||||
|
||||
/**
|
||||
* Tidy up open files that may be left open.
|
||||
*/
|
||||
protected function tearDown() {
|
||||
gc_collect_cycles();
|
||||
}
|
||||
|
||||
public function test_basic() {
|
||||
global $DB;
|
||||
$this->resetAfterTest(true);
|
||||
|
||||
Reference in New Issue
Block a user