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

Added config for delay_duration

parent 9b5c9640
No related branches found
No related tags found
No related merge requests found
...@@ -119,8 +119,9 @@ class process_manager { ...@@ -119,8 +119,9 @@ class process_manager {
* @param process $process process the rollback should be triggered for. * @param process $process process the rollback should be triggered for.
*/ */
public static function rollback_process($process) { public static function rollback_process($process) {
global $CFG;
// TODO: Add logic to revert changes made by steps. // TODO: Add logic to revert changes made by steps.
delayed_courses_manager::set_course_delayed($process->courseid, 60); delayed_courses_manager::set_course_delayed($process->courseid, $CFG->cleanupcourses_duration);
self::remove_process($process); self::remove_process($process);
} }
...@@ -132,6 +133,5 @@ class process_manager { ...@@ -132,6 +133,5 @@ class process_manager {
global $DB; global $DB;
$DB->delete_records('tool_cleanupcourses_procdata', array('processid' => $process->id)); $DB->delete_records('tool_cleanupcourses_procdata', array('processid' => $process->id));
$DB->delete_records('tool_cleanupcourses_process', (array) $process); $DB->delete_records('tool_cleanupcourses_process', (array) $process);
delayed_courses_manager::remove_delay_entry($process->courseid);
} }
} }
...@@ -28,6 +28,8 @@ $string['pluginname'] = 'Cleanup Courses'; ...@@ -28,6 +28,8 @@ $string['pluginname'] = 'Cleanup Courses';
$string['plugintitle'] = 'Cleanup Courses'; $string['plugintitle'] = 'Cleanup Courses';
$string['general_config_header'] = "General & Subplugins"; $string['general_config_header'] = "General & Subplugins";
$string['config_delay_duration'] = 'Duration of a course delay';
$string['config_delay_duration_desc'] = 'Defines the time frame, which a course is excluded from the cleanup course, when rolled back via user interaction.';
$string['active_processes_list_header'] = 'Active Processes'; $string['active_processes_list_header'] = 'Active Processes';
$string['subpluginssettings_heading'] = 'Subplugin Workflow'; $string['subpluginssettings_heading'] = 'Subplugin Workflow';
$string['subpluginssettings_trigger_heading'] = 'Trigger Definition'; $string['subpluginssettings_trigger_heading'] = 'Trigger Definition';
......
...@@ -33,6 +33,11 @@ if ($hassiteconfig) { ...@@ -33,6 +33,11 @@ if ($hassiteconfig) {
get_string('general_config_header', 'tool_cleanupcourses')); get_string('general_config_header', 'tool_cleanupcourses'));
$ADMIN->add('cleanupcourses_category', $settings); $ADMIN->add('cleanupcourses_category', $settings);
$settings->add(new admin_setting_configduration('cleanupcourses_duration',
get_string('config_delay_duration', 'tool_cleanupcourses'),
get_string('config_delay_duration_desc', 'tool_cleanupcourses'),
183 * 24 * 60 * 60)); // Dafault value is 180 days.
$ADMIN->add('cleanupcourses_category', new tool_cleanupcourses\admin_page_active_processes()); $ADMIN->add('cleanupcourses_category', new tool_cleanupcourses\admin_page_active_processes());
$ADMIN->add('cleanupcourses_category', new tool_cleanupcourses\admin_page_sublugins()); $ADMIN->add('cleanupcourses_category', new tool_cleanupcourses\admin_page_sublugins());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment