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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-tool_lifecycle
Commits
3d70a49d
Unverified
Commit
3d70a49d
authored
8 years ago
by
Tobias Reischmann
Browse files
Options
Downloads
Patches
Plain Diff
Added rollback, which currently just deletes the process
parent
c093eecf
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
classes/cleanup_processor.php
+1
-1
1 addition, 1 deletion
classes/cleanup_processor.php
classes/manager/process_manager.php
+19
-1
19 additions, 1 deletion
classes/manager/process_manager.php
with
20 additions
and
2 deletions
classes/cleanup_processor.php
+
1
−
1
View file @
3d70a49d
...
@@ -94,7 +94,7 @@ class cleanup_processor {
...
@@ -94,7 +94,7 @@ class cleanup_processor {
break
;
break
;
}
}
}
else
if
(
$result
==
step_response
::
rollback
())
{
}
else
if
(
$result
==
step_response
::
rollback
())
{
// TODO: Implement Rollback!
process_manager
::
rollback_process
(
$process
);
break
;
break
;
}
else
{
}
else
{
throw
new
\moodle_exception
(
'Return code \''
.
var_dump
(
$result
)
.
'\' is not allowed!'
);
throw
new
\moodle_exception
(
'Return code \''
.
var_dump
(
$result
)
.
'\' is not allowed!'
);
...
...
This diff is collapsed.
Click to expand it.
classes/manager/process_manager.php
+
19
−
1
View file @
3d70a49d
...
@@ -98,7 +98,7 @@ class process_manager {
...
@@ -98,7 +98,7 @@ class process_manager {
// Expected behaviour!
// Expected behaviour!
debugging
(
'Course deleted properly.'
);
debugging
(
'Course deleted properly.'
);
}
}
$DB
->
delete_records
(
'tool_cleanupcourses_process'
,
(
array
)
$process
);
self
::
remove_process
(
$process
);
return
false
;
return
false
;
}
}
}
}
...
@@ -113,4 +113,22 @@ class process_manager {
...
@@ -113,4 +113,22 @@ class process_manager {
$DB
->
update_record
(
'tool_cleanupcourses_process'
,
$process
);
$DB
->
update_record
(
'tool_cleanupcourses_process'
,
$process
);
}
}
/**
* Currently only removes the current process.
* @param process $process process the rollback should be triggered for.
*/
public
static
function
rollback_process
(
$process
)
{
// TODO: Add logic to revert changes made by steps.
self
::
remove_process
(
$process
);
}
/**
* Removes the process and all data connected to it.
* @param process $process process to be deleted.
*/
private
static
function
remove_process
(
$process
)
{
global
$DB
;
$DB
->
delete_records
(
'tool_cleanupcourses_procdata'
,
array
(
'processid'
=>
$process
->
id
));
$DB
->
delete_records
(
'tool_cleanupcourses_process'
,
(
array
)
$process
);
}
}
}
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