MDL-54205 tool_recyclebin: Adding missing destroy() calls.

This was causing controller references not cleaned till gc
and loggers to remain open, leading to problems under windows.
This commit is contained in:
Eloy Lafuente (stronk7)
2016-05-13 01:54:37 +02:00
parent 53f95c99cb
commit da322ad078
2 changed files with 12 additions and 0 deletions
@@ -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,