Skip to content
Snippets Groups Projects
Unverified Commit 366c2119 authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Added pre and post processing operations

parent 74e7627f
No related branches found
No related tags found
No related merge requests found
......@@ -23,6 +23,9 @@
*/
namespace tool_cleanupcourses;
use tool_cleanupcourses\manager\lib_manager;
use tool_cleanupcourses\manager\step_manager;
defined('MOODLE_INTERNAL') || die;
class process_cleanup extends \core\task\scheduled_task {
......@@ -34,6 +37,17 @@ class process_cleanup extends \core\task\scheduled_task {
public function execute() {
$processor = new cleanup_processor();
$processor->call_trigger();
$steps = step_manager::get_step_types();
/** @var \tool_cleanupcourses\step\base[] $steplibs stores the lib classes of all step subplugins.*/
$steplibs = array();
foreach ($steps as $id => $step) {
$steplibs[$id] = lib_manager::get_step_lib($id);
$steplibs[$id]->pre_processing_bulk_operation();
}
$processor->process_courses();
foreach ($steps as $id => $step) {
$steplibs[$id]->post_processing_bulk_operation();
}
}
}
\ No newline at end of file
......@@ -45,6 +45,24 @@ abstract class base {
*/
public abstract function process_course($instanceid, $course);
/**
* Can be overridden to define actions to take place before
* process_course() is called for every relevant course.
*/
public function pre_processing_bulk_operation() {
}
/**
* Can be overridden to define actions to take place after
* process_course() is called for every relevant course.
*/
public function post_processing_bulk_operation() {
}
/**
* The return value should be equivalent with the name of the subplugin folder.
* @return string technical name of the subplugin
*/
public abstract function get_subpluginname();
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment