Enable logs retrieval after course deletion by storing metadata #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue in #1
To Test
Create a test site with a course (use admin/tool/generator/cli/maketestsite.php).
Create a category where you can move the course into.
Move the course into the the newly created category.
Open
admin/tool/lifecycle/workflowdrafts.php
and click "Create new workflow" button.Give the workflow a new title, then click "Save changes".
From the "Add new trigger instance" dropdown, select "Categories Trigger"
Give the new trigger a name, and Select the Category from the dropdown then click Save changes.
From the "Add new step instance" dropdown, select "Backup course log step"
Give the new step a name, then click "Save changes".
Open
admin/tool/lifecycle/workflowdrafts.php
and click the Activate button for the newly created workflow.In a terminal execute the following command
php admin/cli/scheduled_task.php --execute="\tool_lifecycle\task\lifecycle_task"
After executing the task, make sure the log file is generated for that course by checking this link:
admin/tool/lcbackupcourselogstep/logs.php
After this, delete the course by going to
/course/management.php
and deleting the course that you used to create a log file.Then, open this page:
admin/tool/lcbackupcourselogstep/logs.php
Confirm you can still see the log file with the course name and ID (confirm in the database that the course is deleted and that the
mdl_tool_lcbackupcourselogstep_metadata
table contains this data).