Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-tool_lifecycle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
7dff2888
Commit
7dff2888
authored
4 years ago
by
Justus Dieckmann
Browse files
Options
Downloads
Patches
Plain Diff
Add Upgrade-Step that removes processes with deleted courses
parent
30abb343
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
classes/local/manager/process_manager.php
+13
-4
13 additions, 4 deletions
classes/local/manager/process_manager.php
db/upgrade.php
+13
-0
13 additions, 0 deletions
db/upgrade.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
27 additions
and
5 deletions
classes/local/manager/process_manager.php
+
13
−
4
View file @
7dff2888
...
...
@@ -230,10 +230,19 @@ class process_manager {
public
static
function
course_deletion_observed
(
$event
)
{
$process
=
self
::
get_process_by_course_id
(
$event
->
get_data
()[
'courseid'
]);
if
(
$process
)
{
self
::
abort_process
(
$process
);
}
}
/**
* Aborts a running process.
* @param process $process The process to abort.
* @throws \dml_exception
*/
public
static
function
abort_process
(
$process
)
{
$step
=
step_manager
::
get_step_instance_by_workflow_index
(
$process
->
workflowid
,
$process
->
stepindex
);
$steplib
=
lib_manager
::
get_step_lib
(
$step
->
subpluginname
);
$steplib
->
abort_course
(
$process
);
self
::
remove_process
(
$process
);
}
}
}
This diff is collapsed.
Click to expand it.
db/upgrade.php
+
13
−
0
View file @
7dff2888
...
...
@@ -433,5 +433,18 @@ function xmldb_tool_lifecycle_upgrade($oldversion) {
upgrade_plugin_savepoint
(
true
,
2019082300
,
'tool'
,
'lifecycle'
);
}
if
(
$oldversion
<
2020091800
)
{
$sql
=
"SELECT p.* FROM
{
tool_lifecycle_process
}
p "
.
"LEFT JOIN
{
course
}
c ON p.courseid = c.id "
.
"WHERE c.id IS NULL"
;
$processes
=
$DB
->
get_records_sql
(
$sql
);
foreach
(
$processes
as
$procrecord
)
{
$process
=
\tool_lifecycle\local\entity\process
::
from_record
(
$procrecord
);
\tool_lifecycle\local\manager\process_manager
::
abort_process
(
$process
);
}
upgrade_plugin_savepoint
(
true
,
2020091800
,
'tool'
,
'lifecycle'
);
}
return
true
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
7dff2888
...
...
@@ -25,7 +25,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
;
$plugin
->
maturity
=
MATURITY_BETA
;
$plugin
->
version
=
20200
605
00
;
$plugin
->
version
=
20200
918
00
;
$plugin
->
component
=
'tool_lifecycle'
;
$plugin
->
requires
=
2017111300
;
// Require Moodle 3.4 (or above).
$plugin
->
release
=
'v3.9-r1'
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment