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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user