Skip to content

Commit

Permalink
MDL-81525 core_enrol: Correct hook name tense
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Apr 15, 2024
1 parent d2dddb7 commit a7aedc7
Showing 6 changed files with 18 additions and 20 deletions.
18 changes: 9 additions & 9 deletions communication/classes/hook_listener.php
Original file line number Diff line number Diff line change
@@ -19,11 +19,11 @@
use context_course;
use core\hook\access\after_role_assigned;
use core\hook\access\after_role_unassigned;
use core_enrol\hook\before_enrol_instance_delete;
use core_enrol\hook\before_enrol_instance_deleted;
use core_enrol\hook\after_enrol_instance_status_updated;
use core_enrol\hook\after_user_enrolled;
use core_enrol\hook\before_user_enrolment_update;
use core_enrol\hook\before_user_enrolment_remove;
use core_enrol\hook\before_user_enrolment_updated;
use core_enrol\hook\before_user_enrolment_removed;
use core_course\hook\after_course_created;
use core_course\hook\before_course_deleted;
use core_course\hook\after_course_updated;
@@ -533,10 +533,10 @@ public static function update_communication_memberships_for_enrol_status_change(
/**
* Remove the communication instance memberships when an enrolment instance is deleted.
*
* @param before_enrol_instance_delete $hook The enrol instance deleted hook.
* @param before_enrol_instance_deleted $hook The enrol instance deleted hook.
*/
public static function remove_communication_memberships_for_enrol_instance_deletion(
before_enrol_instance_delete $hook,
before_enrol_instance_deleted $hook,
): void {
// If the communication subsystem is not enabled then just ignore.
if (!api::is_available()) {
@@ -591,10 +591,10 @@ public static function add_communication_membership_for_enrolled_user(
/**
* Update the communication instance membership for the user enrolment updates.
*
* @param before_user_enrolment_update $hook The user enrolment updated hook.
* @param before_user_enrolment_updated $hook The user enrolment updated hook.
*/
public static function update_communication_membership_for_updated_user_enrolment(
before_user_enrolment_update $hook,
before_user_enrolment_updated $hook,
): void {
// If the communication subsystem is not enabled then just ignore.
if (!api::is_available()) {
@@ -630,10 +630,10 @@ public static function update_communication_membership_for_updated_user_enrolmen
/**
* Remove communication instance membership for an enrolled user.
*
* @param before_user_enrolment_remove $hook The user unenrolled hook.
* @param before_user_enrolment_removed $hook The user unenrolled hook.
*/
public static function remove_communication_membership_for_unenrolled_user(
before_user_enrolment_remove $hook,
before_user_enrolment_removed $hook,
): void {
// If the communication subsystem is not enabled then just ignore.
if (!api::is_available()) {
Original file line number Diff line number Diff line change
@@ -28,9 +28,8 @@
*/
#[\core\attribute\label('Allows plugins or features to perform actions before the enrolment instance is deleted.')]
#[\core\attribute\tags('enrol')]
class before_enrol_instance_delete implements
class before_enrol_instance_deleted implements
StoppableEventInterface {

/**
* @var bool Whether the propagation of this event has been stopped.
*/
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
*/
#[\core\attribute\label('Allows plugins or features to perform actions before a user enrolment is removed.')]
#[\core\attribute\tags('enrol', 'user')]
class before_user_enrolment_remove {
class before_user_enrolment_removed {

/**
* Constructor for the hook.
Original file line number Diff line number Diff line change
@@ -27,8 +27,7 @@
*/
#[\core\attribute\label('Allows plugins or features to perform actions before a user enrolment is updated.')]
#[\core\attribute\tags('enrol', 'user')]
class before_user_enrolment_update {

class before_user_enrolment_updated {
/**
* Constructor for the hook.
*
6 changes: 3 additions & 3 deletions lib/db/hooks.php
Original file line number Diff line number Diff line change
@@ -78,19 +78,19 @@
'callback' => \core_communication\hook_listener::class . '::update_communication_memberships_for_enrol_status_change',
],
[
'hook' => \core_enrol\hook\before_enrol_instance_delete::class,
'hook' => \core_enrol\hook\before_enrol_instance_deleted::class,
'callback' => \core_communication\hook_listener::class . '::remove_communication_memberships_for_enrol_instance_deletion',
],
[
'hook' => \core_enrol\hook\after_user_enrolled::class,
'callback' => \core_communication\hook_listener::class . '::add_communication_membership_for_enrolled_user',
],
[
'hook' => \core_enrol\hook\before_user_enrolment_update::class,
'hook' => \core_enrol\hook\before_user_enrolment_updated::class,
'callback' => \core_communication\hook_listener::class . '::update_communication_membership_for_updated_user_enrolment',
],
[
'hook' => \core_enrol\hook\before_user_enrolment_remove::class,
'hook' => \core_enrol\hook\before_user_enrolment_removed::class,
'callback' => \core_communication\hook_listener::class . '::remove_communication_membership_for_unenrolled_user',
],
[
6 changes: 3 additions & 3 deletions lib/enrollib.php
Original file line number Diff line number Diff line change
@@ -2238,7 +2238,7 @@ public function update_user_enrol(stdClass $instance, $userid, $status = NULL, $
}

// Dispatch the hook for pre user enrolment update actions.
$hook = new \core_enrol\hook\before_user_enrolment_update(
$hook = new \core_enrol\hook\before_user_enrolment_updated(
enrolinstance: $instance,
userenrolmentinstance: $ue,
statusmodified: $statusmodified,
@@ -2298,7 +2298,7 @@ public function unenrol_user(stdClass $instance, $userid) {
}

// Dispatch the hook for pre user unenrolment actions.
$hook = new \core_enrol\hook\before_user_enrolment_remove(
$hook = new \core_enrol\hook\before_user_enrolment_removed(
enrolinstance: $instance,
userenrolmentinstance: $ue,
);
@@ -2763,7 +2763,7 @@ public function delete_instance($instance) {
}

// Dispatch the hook for pre enrol instance delete actions.
$hook = new \core_enrol\hook\before_enrol_instance_delete(
$hook = new \core_enrol\hook\before_enrol_instance_deleted(
enrolinstance: $instance,
);
\core\di::get(\core\hook\manager::class)->dispatch($hook);

0 comments on commit a7aedc7

Please sign in to comment.