Skip to content

Commit 046855b

Browse files
committed
revert changes to upgrade job
1 parent 5e9f660 commit 046855b

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

classes/tabs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public static function get_tabrow($activelink = false, $deactivatelink = false,
110110
$lcerrors = \html_writer::span($i, $i > 0 ? $classnotnull : $classnull);
111111

112112
// General Settings and Subplugins.
113-
$targeturl = new \moodle_url('/admin/category.php', ['category' => 'lifecycle']);
113+
$targeturl = new \moodle_url('/admin/settings.php', ['section' => 'lifecycle']);
114114
$tabrow[] = new \tabobject('settings', $targeturl,
115115
get_string('general_config_header', 'tool_lifecycle'),
116116
get_string('general_config_header_title', 'tool_lifecycle'));

db/upgrade.php

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2323
*/
2424

25-
use tool_lifecycle\local\manager\step_manager;
26-
use tool_lifecycle\local\manager\trigger_manager;
27-
use tool_lifecycle\local\manager\workflow_manager;
25+
use \tool_lifecycle\local\manager\workflow_manager;
2826

2927
/**
3028
* Fix any gaps in the workflows sortindex.
@@ -569,16 +567,11 @@ function xmldb_tool_lifecycle_upgrade($oldversion) {
569567
$pluginmanager = core_plugin_manager::instance();
570568
if ($plugininfo = $pluginmanager->get_plugin_info('lifecycletrigger_sitecourse')) {
571569
$trace = new \null_progress_trace();
572-
$instances = trigger_manager::get_instances('lifecycletrigger_sitecourse');
573-
foreach ($instances as $instance) {
574-
$workflow = workflow_manager::get_workflow($instance->workflowid);
575-
if (step_manager::count_steps_of_workflow($workflow->id) > 0) {
576-
throw new \moodle_exception('There should be no steps for the workflow of the trigger ' .
577-
'lifecycletrigger_sitecourse');
578-
}
579-
workflow_manager::remove($workflow->id);
570+
$plugininfo->uninstall($trace);
571+
if ($pluginmanager->is_plugin_folder_removable($plugininfo->component)) {
572+
$pluginmanager->uninstall_plugin($plugininfo->component, $trace);
573+
$pluginmanager->remove_plugin_folder($plugininfo);
580574
}
581-
$pluginmanager->uninstall_plugin($plugininfo->component, $trace);
582575
$purgecaches = true;
583576
} else {
584577
$DB->set_field('tool_lifecycle_workflow', 'includesitecourse', 1);
@@ -588,16 +581,11 @@ function xmldb_tool_lifecycle_upgrade($oldversion) {
588581
$pluginmanager = core_plugin_manager::instance();
589582
if ($plugininfo = $pluginmanager->get_plugin_info('lifecycletrigger_delayedcourses')) {
590583
$trace = new \null_progress_trace();
591-
$instances = trigger_manager::get_instances('lifecycletrigger_delayedcourses');
592-
foreach ($instances as $instance) {
593-
$workflow = workflow_manager::get_workflow($instance->workflowid);
594-
if (step_manager::count_steps_of_workflow($workflow->id) > 0) {
595-
throw new \moodle_exception('There should be no steps for the workflow of the trigger ' .
596-
'lifecycletrigger_delayedcourses');
597-
}
598-
workflow_manager::remove($workflow->id);
584+
$plugininfo->uninstall($trace);
585+
if ($pluginmanager->is_plugin_folder_removable($plugininfo->component)) {
586+
$pluginmanager->uninstall_plugin($plugininfo->component, $trace);
587+
$pluginmanager->remove_plugin_folder($plugininfo);
599588
}
600-
$pluginmanager->uninstall_plugin($plugininfo->component, $trace);
601589
$purgecaches = true;
602590
} else {
603591
$DB->set_field('tool_lifecycle_workflow', 'includedelayedcourses', 1);

0 commit comments

Comments
 (0)