MDL-74925 course: use the correct 'remove' action

This commit is contained in:
Simey Lameze
2022-07-18 15:00:15 +08:00
parent e2cd526456
commit 45dfb5ac84
6 changed files with 33 additions and 15 deletions
+19 -1
View File
@@ -134,6 +134,15 @@ class stateupdates implements JsonSerializable {
$this->add_update('section', 'remove', (object)['id' => $sectionid]);
}
/**
* Add track about a section removed.
*
* @param int $sectionid The affected section id.
*/
public function add_section_remove(int $sectionid): void {
$this->add_update('section', 'remove', (object)['id' => $sectionid]);
}
/**
* Add track about a course module state update.
*
@@ -184,11 +193,20 @@ class stateupdates implements JsonSerializable {
$this->add_update('cm', 'remove', (object)['id' => $cmid]);
}
/**
* Add track about a course module removed.
*
* @param int $cmid the affected course module id
*/
public function add_cm_remove(int $cmid): void {
$this->add_update('cm', 'remove', (object)['id' => $cmid]);
}
/**
* Add a valid update message to the update list.
*
* @param string $name the update name
* @param string $action the update action (usually update, create, delete)
* @param string $action the update action (usually update, create, remove)
* @param stdClass $fields the object fields
*/
protected function add_update(string $name, string $action, stdClass $fields): void {