MDL-45319 events: added debugging messages for missing relateduserid value

This commit is contained in:
Mark Nelson
2014-05-07 16:28:59 +08:00
committed by Marina Glancy
parent f1e0f66ca8
commit 425e761712
4 changed files with 36 additions and 1 deletions
+1 -1
View File
@@ -124,6 +124,6 @@ class course_completed extends base {
protected function validate_data() {
parent::validate_data();
// TODO: MDL-45319 add validation of relateduserid and other['relateduserid'].
// TODO: MDL-45445 add validation of relateduserid and other['relateduserid'].
}
}
+15
View File
@@ -98,4 +98,19 @@ class user_created extends base {
protected function get_legacy_logdata() {
return array(SITEID, 'user', 'add', '/view.php?id='.$this->objectid, fullname($this->get_legacy_eventdata()));
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
}
}
+5
View File
@@ -116,6 +116,11 @@ class user_deleted extends base {
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
if (!isset($this->other['username'])) {
throw new \coding_exception('The \'username\' value must be set in other.');
}
+15
View File
@@ -98,4 +98,19 @@ class user_updated extends base {
protected function get_legacy_logdata() {
return array(SITEID, 'user', 'update', 'view.php?id='.$this->objectid, '');
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->relateduserid)) {
debugging('The \'relateduserid\' value must be specified in the event.', DEBUG_DEVELOPER);
$this->relateduserid = $this->objectid;
}
}
}