From b448a5ac67c62ec2ebe5d787519aa6848fddaded Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Sat, 10 May 2014 16:00:31 -0700 Subject: [PATCH 1/5] MDL-45445 events: trivial changes --- lib/classes/event/blog_entries_viewed.php | 7 +++++++ lib/classes/event/content_viewed.php | 6 ++++++ lib/classes/event/course_user_report_viewed.php | 2 +- lib/classes/event/course_viewed.php | 2 +- lib/classes/event/mnet_access_control_created.php | 8 ++++++++ lib/classes/event/mnet_access_control_updated.php | 8 ++++++++ lib/classes/event/notes_viewed.php | 1 + lib/classes/event/recent_activity_viewed.php | 2 +- lib/classes/event/user_graded.php | 1 + lib/classes/event/user_login_failed.php | 4 ++-- lib/classes/event/user_profile_viewed.php | 2 +- lib/classes/event/webservice_function_called.php | 1 - lib/classes/event/webservice_service_created.php | 3 +-- lib/classes/event/webservice_service_deleted.php | 1 - lib/classes/event/webservice_service_updated.php | 10 ---------- lib/classes/event/webservice_service_user_added.php | 1 - lib/classes/event/webservice_service_user_removed.php | 1 - lib/classes/event/webservice_token_sent.php | 1 - .../reveal_identities_confirmation_page_viewed.php | 2 +- .../event/submission_confirmation_form_viewed.php | 2 +- mod/assign/classes/event/submission_status_viewed.php | 2 +- mod/assign/classes/event/workflow_state_updated.php | 2 +- .../onlinetext/classes/event/submission_updated.php | 2 +- mod/workshop/classes/event/assessable_uploaded.php | 7 ------- mod/workshop/classes/event/assessment_evaluated.php | 6 +++--- .../classes/event/assessment_evaluations_reset.php | 4 ++-- mod/workshop/classes/event/assessment_reevaluated.php | 6 +++--- mod/workshop/classes/event/assessments_reset.php | 4 ++-- mod/workshop/classes/event/phase_switched.php | 4 ++-- mod/workshop/classes/event/submission_assessed.php | 6 +++--- mod/workshop/classes/event/submission_created.php | 4 ++-- mod/workshop/classes/event/submission_reassessed.php | 8 ++++---- mod/workshop/classes/event/submission_updated.php | 4 ++-- mod/workshop/classes/event/submission_viewed.php | 4 ++-- .../questioninstances/classes/event/report_viewed.php | 2 +- 35 files changed, 69 insertions(+), 61 deletions(-) diff --git a/lib/classes/event/blog_entries_viewed.php b/lib/classes/event/blog_entries_viewed.php index 117d0a47c7f..b94303f67cb 100644 --- a/lib/classes/event/blog_entries_viewed.php +++ b/lib/classes/event/blog_entries_viewed.php @@ -30,7 +30,14 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * + * - int entryid: id of the entry. + * - int tagid: id of the tag. + * - int userid: id of the user. + * - int modid: id of the mod. + * - int groupid: id of the group. * - int courseid: id of associated course. + * - string search: the string used to search. + * - int fromstart: the time to search from. * } * * @package core diff --git a/lib/classes/event/content_viewed.php b/lib/classes/event/content_viewed.php index d083cbab36f..18231bf91b8 100644 --- a/lib/classes/event/content_viewed.php +++ b/lib/classes/event/content_viewed.php @@ -36,6 +36,12 @@ debugging('core\event\content_viewed has been deprecated. Please extend base eve * * This class has been deprecated, please extend base event or other relevent abstract class. * + * @property-read array $other { + * Extra information about the event. + * + * - string content: name of the content viewed. + * } + * * @package core * @since Moodle 2.6 * @copyright 2013 Ankit Agarwal diff --git a/lib/classes/event/course_user_report_viewed.php b/lib/classes/event/course_user_report_viewed.php index c465a03e207..1e55e562afb 100644 --- a/lib/classes/event/course_user_report_viewed.php +++ b/lib/classes/event/course_user_report_viewed.php @@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class course_user_report_viewed extends \core\event\base { +class course_user_report_viewed extends base { /** * Init method. diff --git a/lib/classes/event/course_viewed.php b/lib/classes/event/course_viewed.php index 7148cde7578..1af160a04e8 100644 --- a/lib/classes/event/course_viewed.php +++ b/lib/classes/event/course_viewed.php @@ -41,7 +41,7 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2014 Adrian Greeve * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class course_viewed extends \core\event\base { +class course_viewed extends base { /** * Init method. diff --git a/lib/classes/event/mnet_access_control_created.php b/lib/classes/event/mnet_access_control_created.php index 90ae3eae06c..1725ddd8222 100644 --- a/lib/classes/event/mnet_access_control_created.php +++ b/lib/classes/event/mnet_access_control_created.php @@ -30,6 +30,14 @@ defined('MOODLE_INTERNAL') || die(); /** * Mnet access control created event class. * + * @property-read array $other { + * Extra information about event. + * + * - string username: the username of the user. + * - string hostname: the name of the host the user came from. + * - string accessctrl: the access control value. + * } + * * @package core * @since Moodle 2.7 * @copyright 2013 Mark Nelson diff --git a/lib/classes/event/mnet_access_control_updated.php b/lib/classes/event/mnet_access_control_updated.php index e42398569c8..cc8b8752351 100644 --- a/lib/classes/event/mnet_access_control_updated.php +++ b/lib/classes/event/mnet_access_control_updated.php @@ -30,6 +30,14 @@ defined('MOODLE_INTERNAL') || die(); /** * Mnet access control updated event class. * + * @property-read array $other { + * Extra information about event. + * + * - string username: the username of the user. + * - string hostname: the name of the host the user came from. + * - string accessctrl: the access control value. + * } + * * @package core * @since Moodle 2.7 * @copyright 2013 Mark Nelson diff --git a/lib/classes/event/notes_viewed.php b/lib/classes/event/notes_viewed.php index b3c4ce6766f..ccbbc5d2148 100644 --- a/lib/classes/event/notes_viewed.php +++ b/lib/classes/event/notes_viewed.php @@ -70,6 +70,7 @@ class notes_viewed extends base { /** * Returns relevant URL. + * * @return \moodle_url */ public function get_url() { diff --git a/lib/classes/event/recent_activity_viewed.php b/lib/classes/event/recent_activity_viewed.php index b70c0f615ae..17fd3bb9896 100644 --- a/lib/classes/event/recent_activity_viewed.php +++ b/lib/classes/event/recent_activity_viewed.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * @copyright 2014 Petr Skoda * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class recent_activity_viewed extends \core\event\base { +class recent_activity_viewed extends base { /** * Init method. diff --git a/lib/classes/event/user_graded.php b/lib/classes/event/user_graded.php index 2deb07790b0..157b90b4e0e 100644 --- a/lib/classes/event/user_graded.php +++ b/lib/classes/event/user_graded.php @@ -72,6 +72,7 @@ class user_graded extends base { /** * Get grade object. * + * @throws \coding_exception * @return \grade_grade */ public function get_grade() { diff --git a/lib/classes/event/user_login_failed.php b/lib/classes/event/user_login_failed.php index 3186d25b7a5..cc1d1a2b2af 100644 --- a/lib/classes/event/user_login_failed.php +++ b/lib/classes/event/user_login_failed.php @@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string username name of user. - * - int reason failure reason. + * - string username: name of user. + * - int reason: failure reason. * } * * @package core diff --git a/lib/classes/event/user_profile_viewed.php b/lib/classes/event/user_profile_viewed.php index ec11331546b..d120303ce8b 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int courseid: id of course. - * - string courseshortname: short name of course. + * - string courseshortname: shortname of course. * - string coursefullname: fullname of course. * } * diff --git a/lib/classes/event/webservice_function_called.php b/lib/classes/event/webservice_function_called.php index 64ac2beed62..b1bde22dbc3 100644 --- a/lib/classes/event/webservice_function_called.php +++ b/lib/classes/event/webservice_function_called.php @@ -105,5 +105,4 @@ class webservice_function_called extends base { throw new \coding_exception('The \'function\' value must be set in other.'); } } - } diff --git a/lib/classes/event/webservice_service_created.php b/lib/classes/event/webservice_service_created.php index f6d27f566df..c844c8aff89 100644 --- a/lib/classes/event/webservice_service_created.php +++ b/lib/classes/event/webservice_service_created.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string: sessionid session id. + * - string sessionid: session id. * } * * @package core @@ -91,5 +91,4 @@ class webservice_service_created extends base { $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'external_services'; } - } diff --git a/lib/classes/event/webservice_service_deleted.php b/lib/classes/event/webservice_service_deleted.php index 56e40beb3ce..120dc708a0a 100644 --- a/lib/classes/event/webservice_service_deleted.php +++ b/lib/classes/event/webservice_service_deleted.php @@ -85,5 +85,4 @@ class webservice_service_deleted extends base { $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'external_services'; } - } diff --git a/lib/classes/event/webservice_service_updated.php b/lib/classes/event/webservice_service_updated.php index e278b481058..a84f4fc20b1 100644 --- a/lib/classes/event/webservice_service_updated.php +++ b/lib/classes/event/webservice_service_updated.php @@ -85,14 +85,4 @@ class webservice_service_updated extends base { $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'external_services'; } - - /** - * Set the legacy event log data. - * - * @return void - */ - public function set_legacy_logdata($legacylogdata) { - $this->legacylogdata = $legacylogdata; - } - } diff --git a/lib/classes/event/webservice_service_user_added.php b/lib/classes/event/webservice_service_user_added.php index 9a3f3e68843..2d423782ec6 100644 --- a/lib/classes/event/webservice_service_user_added.php +++ b/lib/classes/event/webservice_service_user_added.php @@ -98,5 +98,4 @@ class webservice_service_user_added extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } - } diff --git a/lib/classes/event/webservice_service_user_removed.php b/lib/classes/event/webservice_service_user_removed.php index c2248d82d94..50ae27c472b 100644 --- a/lib/classes/event/webservice_service_user_removed.php +++ b/lib/classes/event/webservice_service_user_removed.php @@ -98,5 +98,4 @@ class webservice_service_user_removed extends base { throw new \coding_exception('The \'relateduserid\' must be set.'); } } - } diff --git a/lib/classes/event/webservice_token_sent.php b/lib/classes/event/webservice_token_sent.php index d73d1824a49..f9d9f21c3e6 100644 --- a/lib/classes/event/webservice_token_sent.php +++ b/lib/classes/event/webservice_token_sent.php @@ -73,5 +73,4 @@ class webservice_token_sent extends base { $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'external_tokens'; } - } diff --git a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php index d76411fded1..34913303588 100644 --- a/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php +++ b/mod/assign/classes/event/reveal_identities_confirmation_page_viewed.php @@ -119,7 +119,7 @@ class reveal_identities_confirmation_page_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_confirmation_form_viewed.php b/mod/assign/classes/event/submission_confirmation_form_viewed.php index 43980de7ea5..833d2801b0a 100644 --- a/mod/assign/classes/event/submission_confirmation_form_viewed.php +++ b/mod/assign/classes/event/submission_confirmation_form_viewed.php @@ -120,7 +120,7 @@ class submission_confirmation_form_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/submission_status_viewed.php b/mod/assign/classes/event/submission_status_viewed.php index ce3ea152fae..898042d04c6 100644 --- a/mod/assign/classes/event/submission_status_viewed.php +++ b/mod/assign/classes/event/submission_status_viewed.php @@ -121,7 +121,7 @@ class submission_status_viewed extends base { parent::validate_data(); if (!isset($this->other['assignid'])) { - throw new \coding_exception('The \'assignid\' must be set in other.'); + throw new \coding_exception('The \'assignid\' value must be set in other.'); } } } diff --git a/mod/assign/classes/event/workflow_state_updated.php b/mod/assign/classes/event/workflow_state_updated.php index e7585994484..cfba9dbb1e8 100644 --- a/mod/assign/classes/event/workflow_state_updated.php +++ b/mod/assign/classes/event/workflow_state_updated.php @@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string newstatus: status of submission. + * - string newstate: state of submission. * } * * @package mod_assign diff --git a/mod/assign/submission/onlinetext/classes/event/submission_updated.php b/mod/assign/submission/onlinetext/classes/event/submission_updated.php index fbde4ac0687..356d3a66514 100644 --- a/mod/assign/submission/onlinetext/classes/event/submission_updated.php +++ b/mod/assign/submission/onlinetext/classes/event/submission_updated.php @@ -77,7 +77,7 @@ class submission_updated extends \mod_assign\event\submission_updated { protected function validate_data() { parent::validate_data(); if (!isset($this->other['onlinetextwordcount'])) { - throw new \coding_exception('Other must contain the key onlinetextwordcount.'); + throw new \coding_exception('The \'onlinetextwordcount\' value must be set in other.'); } } } diff --git a/mod/workshop/classes/event/assessable_uploaded.php b/mod/workshop/classes/event/assessable_uploaded.php index c0b3610ed39..861f92de9ed 100644 --- a/mod/workshop/classes/event/assessable_uploaded.php +++ b/mod/workshop/classes/event/assessable_uploaded.php @@ -29,13 +29,6 @@ defined('MOODLE_INTERNAL') || die(); /** * The mod_workshop assessable uploaded event class. * - * @property-read array $other { - * Extra information about event. - * - * - array pathnamehashes: uploaded files path name hashes. - * - string content: string. - * } - * * @package mod_workshop * @since Moodle 2.6 * @copyright 2013 Frédéric Massart diff --git a/mod/workshop/classes/event/assessment_evaluated.php b/mod/workshop/classes/event/assessment_evaluated.php index 61bf086510a..a865b738239 100644 --- a/mod/workshop/classes/event/assessment_evaluated.php +++ b/mod/workshop/classes/event/assessment_evaluated.php @@ -29,10 +29,10 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop assessment evaluated event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - string currentgrade: (could be null) current saved grade. - * - string finalgrade: (could be null) final grade. + * - string currentgrade: (may be null) current saved grade. + * - string finalgrade: (may be null) final grade. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/assessment_evaluations_reset.php b/mod/workshop/classes/event/assessment_evaluations_reset.php index eebc2740b40..6a68335a23b 100644 --- a/mod/workshop/classes/event/assessment_evaluations_reset.php +++ b/mod/workshop/classes/event/assessment_evaluations_reset.php @@ -30,9 +30,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop assessment_evaluations reset event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopid: the ID of the workshop. + * - int workshopid: the ID of the workshop. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/assessment_reevaluated.php b/mod/workshop/classes/event/assessment_reevaluated.php index e3c599afd0d..1e401c473f2 100644 --- a/mod/workshop/classes/event/assessment_reevaluated.php +++ b/mod/workshop/classes/event/assessment_reevaluated.php @@ -29,10 +29,10 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop assessment_reevaluated event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - float currentgrade: (may be null) current saved grade. - * - float finalgrade: (may be null) final grade. + * - float currentgrade: (may be null) current saved grade. + * - float finalgrade: (may be null) final grade. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/assessments_reset.php b/mod/workshop/classes/event/assessments_reset.php index 1c0bc14a0bc..c3b89928d35 100644 --- a/mod/workshop/classes/event/assessments_reset.php +++ b/mod/workshop/classes/event/assessments_reset.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission assessments reset event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopid: the ID of the workshop. + * - int workshopid: the ID of the workshop. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/phase_switched.php b/mod/workshop/classes/event/phase_switched.php index 7786d4ea08a..0d4d3b34389 100644 --- a/mod/workshop/classes/event/phase_switched.php +++ b/mod/workshop/classes/event/phase_switched.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop phase switched event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopphase: Workshop phase. + * - int workshopphase: Workshop phase. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index 2c5e7c3f2bd..d878233eb0d 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -29,10 +29,10 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission assessed event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopid: Workshop ID. - * - int submissionid: Submission ID. + * - int workshopid: Workshop ID. + * - int submissionid: Submission ID. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_created.php b/mod/workshop/classes/event/submission_created.php index 6fdff423af8..97564c5553f 100644 --- a/mod/workshop/classes/event/submission_created.php +++ b/mod/workshop/classes/event/submission_created.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission created event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - string submissiontitle: Submission title. + * - string submissiontitle: Submission title. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index c7f34bb83c5..5d4393d9283 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -29,11 +29,11 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission reassessed event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopid: Workshop ID. - * - int submissionid: Submission ID. - * - float grade: Assessment grade. + * - int workshopid: Workshop ID. + * - int submissionid: Submission ID. + * - float grade: Assessment grade. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_updated.php b/mod/workshop/classes/event/submission_updated.php index 909e7aed655..8275ded6731 100644 --- a/mod/workshop/classes/event/submission_updated.php +++ b/mod/workshop/classes/event/submission_updated.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission updated event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - string submissiontitle: Submission title. + * - string submissiontitle: Submission title. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_viewed.php b/mod/workshop/classes/event/submission_viewed.php index 3f2dc7cb259..5c2e3126241 100644 --- a/mod/workshop/classes/event/submission_viewed.php +++ b/mod/workshop/classes/event/submission_viewed.php @@ -29,9 +29,9 @@ defined('MOODLE_INTERNAL') || die(); * The mod_workshop submission viewed event class. * * @property-read array $other { - * Extra information about the event. + * Extra information about the event. * - * - int workshopid: workshop ID. + * - int workshopid: workshop ID. * } * * @package mod_workshop diff --git a/report/questioninstances/classes/event/report_viewed.php b/report/questioninstances/classes/event/report_viewed.php index c001a539d64..5e79da8f724 100644 --- a/report/questioninstances/classes/event/report_viewed.php +++ b/report/questioninstances/classes/event/report_viewed.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * -string requestedqtype: Requested question type. + * - string requestedqtype: Requested question type. * } * * @package report_questioninstances From 943c61051ff793ced5c4269bd174c788906ecbdc Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 6 May 2014 22:47:21 -0700 Subject: [PATCH 2/5] MDL-45445 events: added missing 'relateduserid' validation --- blog/tests/bloglib_test.php | 5 +++++ lib/classes/event/blog_association_created.php | 16 +++++++++++++--- lib/classes/event/blog_entry_created.php | 14 ++++++++++++++ lib/classes/event/blog_entry_deleted.php | 14 ++++++++++++++ lib/classes/event/blog_entry_updated.php | 14 ++++++++++++++ lib/classes/event/cohort_member_added.php | 14 ++++++++++++++ lib/classes/event/cohort_member_removed.php | 14 ++++++++++++++ lib/classes/event/course_completed.php | 10 +++++++++- lib/classes/event/email_failed.php | 4 ++++ lib/classes/event/group_member_added.php | 4 ++++ lib/classes/event/group_member_removed.php | 14 ++++++++++++++ lib/classes/event/note_created.php | 14 ++++++++++++++ lib/classes/event/note_deleted.php | 14 ++++++++++++++ lib/classes/event/note_updated.php | 14 ++++++++++++++ lib/classes/event/role_assigned.php | 14 ++++++++++++++ lib/classes/event/role_unassigned.php | 14 ++++++++++++++ lib/classes/event/user_graded.php | 14 ++++++++++++++ lib/classes/event/user_loggedinas.php | 14 ++++++++++++++ lib/classes/event/user_profile_viewed.php | 14 ++++++++++++++ mod/feedback/classes/event/response_deleted.php | 3 +++ .../classes/event/response_submitted.php | 3 +++ mod/feedback/tests/events_test.php | 6 +++++- .../classes/event/essay_attempt_viewed.php | 14 ++++++++++++++ mod/scorm/classes/event/interactions_viewed.php | 4 ++++ mod/scorm/classes/event/tracks_viewed.php | 3 +++ mod/scorm/classes/event/user_report_viewed.php | 4 ++++ .../classes/event/submission_assessed.php | 14 ++++++++++++++ .../classes/event/submission_reassessed.php | 14 ++++++++++++++ mod/workshop/classes/event/submission_viewed.php | 14 ++++++++++++++ .../classes/event/user_report_viewed.php | 4 ++++ 30 files changed, 313 insertions(+), 5 deletions(-) diff --git a/blog/tests/bloglib_test.php b/blog/tests/bloglib_test.php index cf1c1dec599..2db22652c11 100644 --- a/blog/tests/bloglib_test.php +++ b/blog/tests/bloglib_test.php @@ -326,6 +326,7 @@ class core_bloglib_testcase extends advanced_testcase { \core\event\blog_association_created::create(array( 'contextid' => 1, 'objectid' => 3, + 'relateduserid' => 2, 'other' => array('associateid' => 2 , 'blogid' => 3, 'subject' => 'blog subject'))); } catch (coding_exception $e) { $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage()); @@ -334,6 +335,7 @@ class core_bloglib_testcase extends advanced_testcase { \core\event\blog_association_created::create(array( 'contextid' => 1, 'objectid' => 3, + 'relateduserid' => 2, 'other' => array('associateid' => 2 , 'blogid' => 3, 'associatetype' => 'random', 'subject' => 'blog subject'))); } catch (coding_exception $e) { $this->assertContains('The \'associatetype\' value must be set in other and be a valid type.', $e->getMessage()); @@ -343,6 +345,7 @@ class core_bloglib_testcase extends advanced_testcase { \core\event\blog_association_created::create(array( 'contextid' => 1, 'objectid' => 3, + 'relateduserid' => 2, 'other' => array('blogid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject'))); } catch (coding_exception $e) { $this->assertContains('The \'associateid\' value must be set in other.', $e->getMessage()); @@ -352,6 +355,7 @@ class core_bloglib_testcase extends advanced_testcase { \core\event\blog_association_created::create(array( 'contextid' => 1, 'objectid' => 3, + 'relateduserid' => 2, 'other' => array('associateid' => 3, 'associatetype' => 'course', 'subject' => 'blog subject'))); } catch (coding_exception $e) { $this->assertContains('The \'blogid\' value must be set in other.', $e->getMessage()); @@ -361,6 +365,7 @@ class core_bloglib_testcase extends advanced_testcase { \core\event\blog_association_created::create(array( 'contextid' => 1, 'objectid' => 3, + 'relateduserid' => 2, 'other' => array('blogid' => 3, 'associateid' => 3, 'associatetype' => 'course'))); } catch (coding_exception $e) { $this->assertContains('The \'subject\' value must be set in other.', $e->getMessage()); diff --git a/lib/classes/event/blog_association_created.php b/lib/classes/event/blog_association_created.php index ba083cb8595..62ae7c9da98 100644 --- a/lib/classes/event/blog_association_created.php +++ b/lib/classes/event/blog_association_created.php @@ -104,14 +104,24 @@ class blog_association_created extends base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (empty($this->other['associatetype']) || ($this->other['associatetype'] !== 'course' && $this->other['associatetype'] !== 'coursemodule')) { throw new \coding_exception('The \'associatetype\' value must be set in other and be a valid type.'); - } else if (!isset($this->other['blogid'])) { + } + + if (!isset($this->other['blogid'])) { throw new \coding_exception('The \'blogid\' value must be set in other.'); - } else if (!isset($this->other['associateid'])) { + } + + if (!isset($this->other['associateid'])) { throw new \coding_exception('The \'associateid\' value must be set in other.'); - } else if (!isset($this->other['subject'])) { + } + + if (!isset($this->other['subject'])) { throw new \coding_exception('The \'subject\' value must be set in other.'); } } diff --git a/lib/classes/event/blog_entry_created.php b/lib/classes/event/blog_entry_created.php index 36acac51c67..1f39bed35b6 100644 --- a/lib/classes/event/blog_entry_created.php +++ b/lib/classes/event/blog_entry_created.php @@ -126,4 +126,18 @@ class blog_entry_created extends base { return array (SITEID, 'blog', 'add', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid, $this->blogentry->subject); } + + /** + * Custom validations. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/blog_entry_deleted.php b/lib/classes/event/blog_entry_deleted.php index c7c3a63c0b5..2321e42f51b 100644 --- a/lib/classes/event/blog_entry_deleted.php +++ b/lib/classes/event/blog_entry_deleted.php @@ -117,4 +117,18 @@ class blog_entry_deleted extends base { return array (SITEID, 'blog', 'delete', 'index.php?userid=' . $this->relateduserid, 'deleted blog entry with entry id# '. $this->objectid); } + + /** + * Custom validations. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/blog_entry_updated.php b/lib/classes/event/blog_entry_updated.php index 893e8301ce6..4b9237162e7 100644 --- a/lib/classes/event/blog_entry_updated.php +++ b/lib/classes/event/blog_entry_updated.php @@ -124,5 +124,19 @@ class blog_entry_updated extends base { return array(SITEID, 'blog', 'update', 'index.php?userid=' . $this->relateduserid . '&entryid=' . $this->objectid, $this->blogentry->subject); } + + /** + * Custom validations. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/cohort_member_added.php b/lib/classes/event/cohort_member_added.php index 6a944ea68f0..018d854ec1f 100644 --- a/lib/classes/event/cohort_member_added.php +++ b/lib/classes/event/cohort_member_added.php @@ -94,4 +94,18 @@ class cohort_member_added extends base { $data->userid = $this->relateduserid; return $data; } + + /** + * Custom validations. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/cohort_member_removed.php b/lib/classes/event/cohort_member_removed.php index 68b29e3ee2b..25c902adf30 100644 --- a/lib/classes/event/cohort_member_removed.php +++ b/lib/classes/event/cohort_member_removed.php @@ -95,4 +95,18 @@ class cohort_member_removed extends base { $data->userid = $this->relateduserid; return $data; } + + /** + * Custom validations. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/course_completed.php b/lib/classes/event/course_completed.php index cd4bbdc6e23..ed51fa97d3b 100644 --- a/lib/classes/event/course_completed.php +++ b/lib/classes/event/course_completed.php @@ -124,6 +124,14 @@ class course_completed extends base { protected function validate_data() { parent::validate_data(); - // TODO: MDL-45445 add validation of relateduserid and other['relateduserid']. + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + + // Check that the 'relateduserid' value is set in other as well. This is because we introduced this in 2.6 + // and some observers may be relying on this value to be present. + if (!isset($this->other['relateduserid'])) { + throw new \coding_exception('The \'relateduserid\' value must be set in other.'); + } } } diff --git a/lib/classes/event/email_failed.php b/lib/classes/event/email_failed.php index d62e2c79707..461f4581c93 100644 --- a/lib/classes/event/email_failed.php +++ b/lib/classes/event/email_failed.php @@ -80,6 +80,10 @@ class email_failed extends base { */ protected function validate_data() { parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } if (!isset($this->other['subject'])) { throw new \coding_exception('The \'subject\' value must be set in other.'); } diff --git a/lib/classes/event/group_member_added.php b/lib/classes/event/group_member_added.php index 2cb197f7a64..1da73bca3e2 100644 --- a/lib/classes/event/group_member_added.php +++ b/lib/classes/event/group_member_added.php @@ -113,6 +113,10 @@ class group_member_added extends base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (!isset($this->other['component'])) { throw new \coding_exception('The \'component\' value must be set in other, even if empty.'); } diff --git a/lib/classes/event/group_member_removed.php b/lib/classes/event/group_member_removed.php index 6fca12778a5..1acc7789fb5 100644 --- a/lib/classes/event/group_member_removed.php +++ b/lib/classes/event/group_member_removed.php @@ -94,4 +94,18 @@ class group_member_removed extends base { $this->data['edulevel'] = self::LEVEL_OTHER; $this->data['objecttable'] = 'groups'; } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/note_created.php b/lib/classes/event/note_created.php index 62ce5bd926f..dc303f46d6f 100644 --- a/lib/classes/event/note_created.php +++ b/lib/classes/event/note_created.php @@ -92,4 +92,18 @@ class note_created extends base { $logurl->set_anchor('note-' . $this->objectid); return array($this->courseid, 'notes', 'add', $logurl, 'add note'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/note_deleted.php b/lib/classes/event/note_deleted.php index 8af710b89d5..6f446051f26 100644 --- a/lib/classes/event/note_deleted.php +++ b/lib/classes/event/note_deleted.php @@ -82,4 +82,18 @@ class note_deleted extends base { $logurl->set_anchor('note-' . $this->objectid); return array($this->courseid, 'notes', 'delete', $logurl, 'delete note'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/note_updated.php b/lib/classes/event/note_updated.php index 43a0ed89370..08b4dcd7b10 100644 --- a/lib/classes/event/note_updated.php +++ b/lib/classes/event/note_updated.php @@ -92,4 +92,18 @@ class note_updated extends base { $logurl->set_anchor('note-' . $this->objectid); return array($this->courseid, 'notes', 'update', $logurl, 'update note'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/role_assigned.php b/lib/classes/event/role_assigned.php index 4b86c8cf3f7..85c6051420a 100644 --- a/lib/classes/event/role_assigned.php +++ b/lib/classes/event/role_assigned.php @@ -109,4 +109,18 @@ class role_assigned extends base { return array($this->courseid, 'role', 'assign', 'admin/roles/assign.php?contextid='.$this->contextid.'&roleid='.$this->objectid, $rolenames[$this->objectid], '', $this->userid); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/role_unassigned.php b/lib/classes/event/role_unassigned.php index 31f00a02f6c..f0888be2483 100644 --- a/lib/classes/event/role_unassigned.php +++ b/lib/classes/event/role_unassigned.php @@ -106,4 +106,18 @@ class role_unassigned extends base { return array($this->courseid, 'role', 'unassign', 'admin/roles/assign.php?contextid='.$this->contextid.'&roleid='.$this->objectid, $rolenames[$this->objectid], '', $this->userid); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/user_graded.php b/lib/classes/event/user_graded.php index 157b90b4e0e..61c89803a24 100644 --- a/lib/classes/event/user_graded.php +++ b/lib/classes/event/user_graded.php @@ -138,4 +138,18 @@ class user_graded extends base { return array($this->courseid, 'grade', 'update', $url, $info); } + + /** + * Custom validation. + * + * @throws \coding_exception when validation does not pass. + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/user_loggedinas.php b/lib/classes/event/user_loggedinas.php index 2e6b4dd7d59..0e32b29aa07 100644 --- a/lib/classes/event/user_loggedinas.php +++ b/lib/classes/event/user_loggedinas.php @@ -90,4 +90,18 @@ class user_loggedinas extends base { public function get_url() { return new \moodle_url('/user/view.php', array('id' => $this->objectid)); } + + /** + * Custom validation. + * + * @throws \coding_exception when validation does not pass. + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/lib/classes/event/user_profile_viewed.php b/lib/classes/event/user_profile_viewed.php index d120303ce8b..277aa97cf85 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -97,4 +97,18 @@ class user_profile_viewed extends base { } return null; } + + /** + * Custom validation. + * + * @throws \coding_exception when validation does not pass. + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/mod/feedback/classes/event/response_deleted.php b/mod/feedback/classes/event/response_deleted.php index 686f7577d3e..00a1105a722 100644 --- a/mod/feedback/classes/event/response_deleted.php +++ b/mod/feedback/classes/event/response_deleted.php @@ -113,6 +113,9 @@ class response_deleted extends \core\event\base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } if (!isset($this->other['anonymous'])) { throw new \coding_exception('The \'anonymous\' value must be set in other.'); } diff --git a/mod/feedback/classes/event/response_submitted.php b/mod/feedback/classes/event/response_submitted.php index 8dc8d98fb2c..acd1dcc7fea 100644 --- a/mod/feedback/classes/event/response_submitted.php +++ b/mod/feedback/classes/event/response_submitted.php @@ -135,6 +135,9 @@ class response_submitted extends \core\event\base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } if (!isset($this->other['anonymous'])) { throw new \coding_exception('The \'anonymous\' value must be set in other.'); } diff --git a/mod/feedback/tests/events_test.php b/mod/feedback/tests/events_test.php index 300c2311188..84133882ef9 100644 --- a/mod/feedback/tests/events_test.php +++ b/mod/feedback/tests/events_test.php @@ -184,7 +184,8 @@ class mod_feedback_events_testcase extends advanced_testcase { try { \mod_feedback\event\response_submitted::create(array( 'context' => $context, - 'objectid' => $this->eventfeedbackcompleted->id + 'objectid' => $this->eventfeedbackcompleted->id, + 'relateduserid' => 2, )); $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without other['anonymous']"); @@ -289,6 +290,7 @@ class mod_feedback_events_testcase extends advanced_testcase { \mod_feedback\event\response_submitted::create(array( 'context' => $context, 'objectid' => $this->eventfeedbackcompleted->id, + 'relateduserid' => 2, 'anonymous' => 0, 'other' => array('cmid' => $this->eventcm->id, 'anonymous' => 2) )); @@ -303,6 +305,7 @@ class mod_feedback_events_testcase extends advanced_testcase { \mod_feedback\event\response_submitted::create(array( 'context' => $context, 'objectid' => $this->eventfeedbackcompleted->id, + 'relateduserid' => 2, 'anonymous' => 0, 'other' => array('instanceid' => $this->eventfeedback->id, 'anonymous' => 2) )); @@ -317,6 +320,7 @@ class mod_feedback_events_testcase extends advanced_testcase { \mod_feedback\event\response_submitted::create(array( 'context' => $context, 'objectid' => $this->eventfeedbackcompleted->id, + 'relateduserid' => 2, 'other' => array('cmid' => $this->eventcm->id, 'instanceid' => $this->eventfeedback->id) )); $this->fail("Event validation should not allow \\mod_feedback\\event\\response_deleted to be triggered without diff --git a/mod/lesson/classes/event/essay_attempt_viewed.php b/mod/lesson/classes/event/essay_attempt_viewed.php index 8d1ac192c82..5e179228624 100644 --- a/mod/lesson/classes/event/essay_attempt_viewed.php +++ b/mod/lesson/classes/event/essay_attempt_viewed.php @@ -83,4 +83,18 @@ class essay_attempt_viewed extends \core\event\base { return array($this->courseid, 'lesson', 'view grade', 'essay.php?id=' . $this->contextinstanceid . '&mode=grade&attemptid=' . $this->objectid, get_string('manualgrading', 'lesson'), $this->contextinstanceid); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/mod/scorm/classes/event/interactions_viewed.php b/mod/scorm/classes/event/interactions_viewed.php index face571f620..91dcc8e1419 100644 --- a/mod/scorm/classes/event/interactions_viewed.php +++ b/mod/scorm/classes/event/interactions_viewed.php @@ -103,6 +103,10 @@ class interactions_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + if (empty($this->other['attemptid'])) { throw new \coding_exception('The \'attemptid\' must be set in other.'); } diff --git a/mod/scorm/classes/event/tracks_viewed.php b/mod/scorm/classes/event/tracks_viewed.php index 14200953146..d76812ddb50 100644 --- a/mod/scorm/classes/event/tracks_viewed.php +++ b/mod/scorm/classes/event/tracks_viewed.php @@ -105,6 +105,9 @@ class tracks_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } if (empty($this->other['attemptid'])) { throw new \coding_exception('The \'attemptid\' value must be set in other.'); } diff --git a/mod/scorm/classes/event/user_report_viewed.php b/mod/scorm/classes/event/user_report_viewed.php index 9fece2d77e4..b91ad5582b1 100644 --- a/mod/scorm/classes/event/user_report_viewed.php +++ b/mod/scorm/classes/event/user_report_viewed.php @@ -101,6 +101,10 @@ class user_report_viewed extends \core\event\base { */ protected function validate_data() { parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } if (empty($this->other['attemptid'])) { throw new \coding_exception('The \'attemptid\' value must be set in other.'); } diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index d878233eb0d..7c7e4dcc69b 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -90,4 +90,18 @@ class submission_assessed extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/assessment.php', array('asid' => $this->objectid)); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index 5d4393d9283..eb05f0332d5 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -91,4 +91,18 @@ class submission_reassessed extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/assessment.php?', array('asid' => $this->objectid)); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/mod/workshop/classes/event/submission_viewed.php b/mod/workshop/classes/event/submission_viewed.php index 5c2e3126241..ffe6013279e 100644 --- a/mod/workshop/classes/event/submission_viewed.php +++ b/mod/workshop/classes/event/submission_viewed.php @@ -88,4 +88,18 @@ class submission_viewed extends \core\event\base { 'submission.php?cmid=' . $this->contextinstanceid . '&id=' . $this->objectid, $this->objectid, $this->contextinstanceid); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } + } } diff --git a/report/completion/classes/event/user_report_viewed.php b/report/completion/classes/event/user_report_viewed.php index ca046c59e6c..f8193a85096 100644 --- a/report/completion/classes/event/user_report_viewed.php +++ b/report/completion/classes/event/user_report_viewed.php @@ -94,5 +94,9 @@ class user_report_viewed extends \core\event\base { if ($this->contextlevel != CONTEXT_COURSE) { throw new \coding_exception('Context level must be CONTEXT_COURSE.'); } + + if (!isset($this->relateduserid)) { + throw new \coding_exception('The \'relateduserid\' must be set.'); + } } } From d0c65a411f05d2f9c06ed264c84bd011f38cb29f Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 7 May 2014 19:12:06 -0700 Subject: [PATCH 3/5] MDL-45445 events: added missing 'other' validation --- lib/classes/event/course_category_deleted.php | 14 +++++++++ lib/classes/event/course_content_deleted.php | 14 +++++++++ lib/classes/event/course_created.php | 14 +++++++++ lib/classes/event/course_deleted.php | 14 +++++++++ lib/classes/event/course_restored.php | 30 +++++++++++++++++++ lib/classes/event/role_assigned.php | 8 +++++ lib/classes/event/role_deleted.php | 14 +++++++++ lib/classes/event/role_unassigned.php | 8 +++++ lib/classes/event/user_graded.php | 4 +++ lib/classes/event/user_loggedinas.php | 8 +++++ .../event/webservice_token_created.php | 4 +++ mod/scorm/classes/event/report_viewed.php | 4 +++ .../event/assessment_evaluations_reset.php | 14 +++++++++ .../classes/event/assessments_reset.php | 14 +++++++++ mod/workshop/classes/event/phase_switched.php | 14 +++++++++ .../classes/event/submission_assessed.php | 4 +++ .../classes/event/submission_reassessed.php | 4 +++ 17 files changed, 186 insertions(+) diff --git a/lib/classes/event/course_category_deleted.php b/lib/classes/event/course_category_deleted.php index 5c6bbee5a21..4d80eeea830 100644 --- a/lib/classes/event/course_category_deleted.php +++ b/lib/classes/event/course_category_deleted.php @@ -122,4 +122,18 @@ class course_category_deleted extends base { protected function get_legacy_logdata() { return array(SITEID, 'category', 'delete', 'index.php', $this->other['name'] . '(ID ' . $this->objectid . ')'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['name'])) { + throw new \coding_exception('The \'name\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/course_content_deleted.php b/lib/classes/event/course_content_deleted.php index 42161dd9ece..dbea00d4d3a 100644 --- a/lib/classes/event/course_content_deleted.php +++ b/lib/classes/event/course_content_deleted.php @@ -90,4 +90,18 @@ class course_content_deleted extends base { return $course; } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['options'])) { + throw new \coding_exception('The \'options\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/course_created.php b/lib/classes/event/course_created.php index 56a6d61c210..0836ccb10fa 100644 --- a/lib/classes/event/course_created.php +++ b/lib/classes/event/course_created.php @@ -105,4 +105,18 @@ class course_created extends base { protected function get_legacy_logdata() { return array(SITEID, 'course', 'new', 'view.php?id=' . $this->objectid, $this->other['fullname'] . ' (ID ' . $this->objectid . ')'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['fullname'])) { + throw new \coding_exception('The \'fullname\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/course_deleted.php b/lib/classes/event/course_deleted.php index ca272809efe..d89aa1966f1 100644 --- a/lib/classes/event/course_deleted.php +++ b/lib/classes/event/course_deleted.php @@ -100,4 +100,18 @@ class course_deleted extends base { protected function get_legacy_logdata() { return array(SITEID, 'course', 'delete', 'view.php?id=' . $this->objectid, $this->other['fullname'] . '(ID ' . $this->objectid . ')'); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['fullname'])) { + throw new \coding_exception('The \'fullname\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/course_restored.php b/lib/classes/event/course_restored.php index 8ccfc26fd26..1d5230c200c 100644 --- a/lib/classes/event/course_restored.php +++ b/lib/classes/event/course_restored.php @@ -107,4 +107,34 @@ class course_restored extends base { 'samesite' => $this->other['samesite'], ); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['type'])) { + throw new \coding_exception('The \'type\' value must be set in other.'); + } + + if (!isset($this->other['target'])) { + throw new \coding_exception('The \'target\' value must be set in other.'); + } + + if (!isset($this->other['mode'])) { + throw new \coding_exception('The \'mode\' value must be set in other.'); + } + + if (!isset($this->other['operation'])) { + throw new \coding_exception('The \'operation\' value must be set in other.'); + } + + if (!isset($this->other['samesite'])) { + throw new \coding_exception('The \'samesite\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/role_assigned.php b/lib/classes/event/role_assigned.php index 85c6051420a..6722959d9bf 100644 --- a/lib/classes/event/role_assigned.php +++ b/lib/classes/event/role_assigned.php @@ -122,5 +122,13 @@ class role_assigned extends base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['id'])) { + throw new \coding_exception('The \'id\' value must be set in other.'); + } + + if (!isset($this->other['component'])) { + throw new \coding_exception('The \'component\' value must be set in other.'); + } } } diff --git a/lib/classes/event/role_deleted.php b/lib/classes/event/role_deleted.php index a259419bf00..f80003de35f 100644 --- a/lib/classes/event/role_deleted.php +++ b/lib/classes/event/role_deleted.php @@ -88,4 +88,18 @@ class role_deleted extends base { return array(SITEID, 'role', 'delete', 'admin/roles/manage.php?action=delete&roleid=' . $this->objectid, $this->other['shortname'], ''); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['shortname'])) { + throw new \coding_exception('The \'shortname\' value must be set in other.'); + } + } } diff --git a/lib/classes/event/role_unassigned.php b/lib/classes/event/role_unassigned.php index f0888be2483..79928c31cac 100644 --- a/lib/classes/event/role_unassigned.php +++ b/lib/classes/event/role_unassigned.php @@ -119,5 +119,13 @@ class role_unassigned extends base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['id'])) { + throw new \coding_exception('The \'id\' value must be set in other.'); + } + + if (!isset($this->other['component'])) { + throw new \coding_exception('The \'component\' value must be set in other.'); + } } } diff --git a/lib/classes/event/user_graded.php b/lib/classes/event/user_graded.php index 61c89803a24..9af099f4194 100644 --- a/lib/classes/event/user_graded.php +++ b/lib/classes/event/user_graded.php @@ -151,5 +151,9 @@ class user_graded extends base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['itemid'])) { + throw new \coding_exception('The \'itemid\' value must be set in other.'); + } } } diff --git a/lib/classes/event/user_loggedinas.php b/lib/classes/event/user_loggedinas.php index 0e32b29aa07..494038fd001 100644 --- a/lib/classes/event/user_loggedinas.php +++ b/lib/classes/event/user_loggedinas.php @@ -103,5 +103,13 @@ class user_loggedinas extends base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['originalusername'])) { + throw new \coding_exception('The \'originalusername\' value must be set in other.'); + } + + if (!isset($this->other['loggedinasusername'])) { + throw new \coding_exception('The \'loggedinasusername\' value must be set in other.'); + } } } diff --git a/lib/classes/event/webservice_token_created.php b/lib/classes/event/webservice_token_created.php index 65da1bb0ba2..a816dbead50 100644 --- a/lib/classes/event/webservice_token_created.php +++ b/lib/classes/event/webservice_token_created.php @@ -103,5 +103,9 @@ class webservice_token_created extends base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['auto'])) { + throw new \coding_exception('The \'auto\' value must be set in other.'); + } } } diff --git a/mod/scorm/classes/event/report_viewed.php b/mod/scorm/classes/event/report_viewed.php index 37d0c2a5b85..edd61f3f3d5 100644 --- a/mod/scorm/classes/event/report_viewed.php +++ b/mod/scorm/classes/event/report_viewed.php @@ -97,6 +97,10 @@ class report_viewed extends \core\event\base { protected function validate_data() { parent::validate_data(); + if (empty($this->other['scormid'])) { + throw new \coding_exception('The \'scormid\' value must be set in other.'); + } + if (empty($this->other['mode'])) { throw new \coding_exception('The \'mode\' value must be set in other.'); } diff --git a/mod/workshop/classes/event/assessment_evaluations_reset.php b/mod/workshop/classes/event/assessment_evaluations_reset.php index 6a68335a23b..68145df942d 100644 --- a/mod/workshop/classes/event/assessment_evaluations_reset.php +++ b/mod/workshop/classes/event/assessment_evaluations_reset.php @@ -89,4 +89,18 @@ class assessment_evaluations_reset extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid)); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['workshopid'])) { + throw new \coding_exception('The \'workshopid\' value must be set in other.'); + } + } } diff --git a/mod/workshop/classes/event/assessments_reset.php b/mod/workshop/classes/event/assessments_reset.php index c3b89928d35..2e1a32b6c4c 100644 --- a/mod/workshop/classes/event/assessments_reset.php +++ b/mod/workshop/classes/event/assessments_reset.php @@ -88,4 +88,18 @@ class assessments_reset extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid)); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['workshopid'])) { + throw new \coding_exception('The \'workshopid\' value must be set in other.'); + } + } } diff --git a/mod/workshop/classes/event/phase_switched.php b/mod/workshop/classes/event/phase_switched.php index 0d4d3b34389..faefe75e920 100644 --- a/mod/workshop/classes/event/phase_switched.php +++ b/mod/workshop/classes/event/phase_switched.php @@ -89,4 +89,18 @@ class phase_switched extends \core\event\base { public function get_url() { return new \moodle_url('/mod/workshop/view.php', array('id' => $this->contextinstanceid)); } + + /** + * Custom validation. + * + * @throws \coding_exception + * @return void + */ + protected function validate_data() { + parent::validate_data(); + + if (!isset($this->other['workshopphase'])) { + throw new \coding_exception('The \'workshopphase\' value must be set in other.'); + } + } } diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index 7c7e4dcc69b..57ccf640927 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -103,5 +103,9 @@ class submission_assessed extends \core\event\base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['submissionid'])) { + throw new \coding_exception('The \'submissionid\' value must be set in other.'); + } } } diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index eb05f0332d5..c66a8fc8619 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -104,5 +104,9 @@ class submission_reassessed extends \core\event\base { if (!isset($this->relateduserid)) { throw new \coding_exception('The \'relateduserid\' must be set.'); } + + if (!isset($this->other['submissionid'])) { + throw new \coding_exception('The \'submissionid\' value must be set in other.'); + } } } From c446f41a8546de77972c597410353e87e92cbee6 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 6 May 2014 22:53:54 -0700 Subject: [PATCH 4/5] MDL-45445 events: documented the additional validation --- lib/upgrade.txt | 28 ++++++++++++++++++++++++++-- mod/feedback/upgrade.txt | 5 +++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 mod/feedback/upgrade.txt diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 93b1367d7d6..f651affd9c2 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -10,8 +10,32 @@ Events and Logging: * Significant changes in Logging API. For upgrading existing events_trigger() and add_to_log() see http://docs.moodle.org/dev/Migrating_logging_calls_in_plugins For accessing logs from plugins see http://docs.moodle.org/dev/Migrating_log_access_in_reports -* The validation of the following events is now stricter: - - \core\event\course_section_updated +* The validation of the following events is now stricter (see MDL-45445): + - \core\event\blog_entry_created + - \core\event\blog_entry_deleted + - \core\event\blog_entry_updated + - \core\event\cohort_member_added + - \core\event\cohort_member_removed + - \core\event\course_category_deleted + - \core\event\course_completed + - \core\event\course_content_deleted + - \core\event\course_created + - \core\event\course_deleted + - \core\event\course_restored + - \core\event\course_section_updated (see MDL-45229) + - \core\event\email_failed + - \core\event\group_member_added + - \core\event\group_member_removed + - \core\event\note_created + - \core\event\note_deleted + - \core\event\note_updated + - \core\event\role_assigned + - \core\event\role_deleted + - \core\event\role_unassigned + - \core\event\user_graded + - \core\event\user_loggedinas + - \core\event\user_profile_viewed + - \core\event\webservice_token_created DEPRECATIONS: * $module uses in mod/xxx/version.php files is now deprecated. Please use $plugin instead. It will be removed in Moodle 2.10. diff --git a/mod/feedback/upgrade.txt b/mod/feedback/upgrade.txt new file mode 100644 index 00000000000..eee47a8938e --- /dev/null +++ b/mod/feedback/upgrade.txt @@ -0,0 +1,5 @@ +=== 2.7 === + +* The validation of the following events is now stricter (see MDL-45445): + - \mod_feedback\event\response_deleted + - \mod_feedback\event\response_submitted From 3b0347712a05b15c5e8d7ee0df54b862432e0a9f Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Sat, 10 May 2014 16:07:56 -0700 Subject: [PATCH 5/5] MDL-45445 events: added '(optional)' to event params where applicable --- lib/classes/event/blog_entries_viewed.php | 16 ++++++++-------- lib/classes/event/course_created.php | 2 +- lib/classes/event/course_deleted.php | 4 ++-- lib/classes/event/course_updated.php | 4 ++-- lib/classes/event/note_created.php | 2 +- lib/classes/event/note_deleted.php | 2 +- lib/classes/event/note_updated.php | 2 +- lib/classes/event/role_assigned.php | 2 +- lib/classes/event/role_deleted.php | 4 ++-- lib/classes/event/role_unassigned.php | 2 +- lib/classes/event/user_graded.php | 4 ++-- lib/classes/event/user_list_viewed.php | 4 ++-- lib/classes/event/user_loggedout.php | 2 +- lib/classes/event/user_profile_viewed.php | 6 +++--- lib/classes/event/webservice_service_created.php | 2 +- .../classes/event/assessable_uploaded.php | 2 +- mod/choice/classes/event/answer_submitted.php | 2 +- mod/choice/classes/event/answer_updated.php | 2 +- mod/glossary/classes/event/entry_created.php | 2 +- mod/glossary/classes/event/entry_deleted.php | 2 +- mod/glossary/classes/event/entry_updated.php | 2 +- mod/quiz/classes/event/attempt_abandoned.php | 2 +- mod/quiz/classes/event/attempt_becameoverdue.php | 2 +- mod/quiz/classes/event/attempt_submitted.php | 2 +- mod/scorm/classes/event/sco_launched.php | 2 +- mod/wiki/classes/event/page_locks_deleted.php | 2 +- mod/wiki/classes/event/page_updated.php | 2 +- .../classes/event/submission_assessed.php | 2 +- .../classes/event/submission_created.php | 2 +- .../classes/event/submission_reassessed.php | 4 ++-- .../classes/event/submission_updated.php | 2 +- mod/workshop/classes/event/submission_viewed.php | 2 +- 32 files changed, 47 insertions(+), 47 deletions(-) diff --git a/lib/classes/event/blog_entries_viewed.php b/lib/classes/event/blog_entries_viewed.php index b94303f67cb..632b892fcdb 100644 --- a/lib/classes/event/blog_entries_viewed.php +++ b/lib/classes/event/blog_entries_viewed.php @@ -30,14 +30,14 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - int entryid: id of the entry. - * - int tagid: id of the tag. - * - int userid: id of the user. - * - int modid: id of the mod. - * - int groupid: id of the group. - * - int courseid: id of associated course. - * - string search: the string used to search. - * - int fromstart: the time to search from. + * - int entryid: (optional) id of the entry. + * - int tagid: (optional) id of the tag. + * - int userid: (optional) id of the user. + * - int modid: (optional) id of the mod. + * - int groupid: (optional) id of the group. + * - int courseid: (optional) id of associated course. + * - string search: (optional) the string used to search. + * - int fromstart: (optional) the time to search from. * } * * @package core diff --git a/lib/classes/event/course_created.php b/lib/classes/event/course_created.php index 0836ccb10fa..699dcc15785 100644 --- a/lib/classes/event/course_created.php +++ b/lib/classes/event/course_created.php @@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string shortname: shortname of course. * - string fullname: fullname of course. + * - string shortname: (optional) shortname of course. * } * * @package core diff --git a/lib/classes/event/course_deleted.php b/lib/classes/event/course_deleted.php index d89aa1966f1..19641ffef42 100644 --- a/lib/classes/event/course_deleted.php +++ b/lib/classes/event/course_deleted.php @@ -32,9 +32,9 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string shortname: shortname of course. * - string fullname: fullname of course. - * - string idnumber: id number of course. + * - string shortname: (optional) shortname of course. + * - string idnumber: (optional) id number of course. * } * * @package core diff --git a/lib/classes/event/course_updated.php b/lib/classes/event/course_updated.php index e7053b298d0..a49e9c2852e 100644 --- a/lib/classes/event/course_updated.php +++ b/lib/classes/event/course_updated.php @@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string shortname: shortname of course. - * - string fullname: fullname of course. + * - string shortname: (optional) shortname of course. + * - string fullname: (optional) fullname of course. * } * * @package core diff --git a/lib/classes/event/note_created.php b/lib/classes/event/note_created.php index dc303f46d6f..e6720eb8353 100644 --- a/lib/classes/event/note_created.php +++ b/lib/classes/event/note_created.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string publishstate: the publish state. + * - string publishstate: (optional) the publish state. * } * * @package core diff --git a/lib/classes/event/note_deleted.php b/lib/classes/event/note_deleted.php index 6f446051f26..0e127cad45f 100644 --- a/lib/classes/event/note_deleted.php +++ b/lib/classes/event/note_deleted.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string publishstate: the publish state. + * - string publishstate: (optional) the publish state. * } * * @package core diff --git a/lib/classes/event/note_updated.php b/lib/classes/event/note_updated.php index 08b4dcd7b10..816816b6fcb 100644 --- a/lib/classes/event/note_updated.php +++ b/lib/classes/event/note_updated.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string publishstate: the publish state. + * - string publishstate: (optional) the publish state. * } * * @package core diff --git a/lib/classes/event/role_assigned.php b/lib/classes/event/role_assigned.php index 6722959d9bf..78682dad9e8 100644 --- a/lib/classes/event/role_assigned.php +++ b/lib/classes/event/role_assigned.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * * - int id: role assigned id. * - string component: name of component. - * - int itemid: id of the item. + * - int itemid: (optional) id of the item. * } * * @package core diff --git a/lib/classes/event/role_deleted.php b/lib/classes/event/role_deleted.php index f80003de35f..9b5a2e2bd0f 100644 --- a/lib/classes/event/role_deleted.php +++ b/lib/classes/event/role_deleted.php @@ -33,8 +33,8 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - string shortname: shortname of role. - * - string description: role description. - * - string archetype: role type. + * - string description: (optional) role description. + * - string archetype: (optional) role type. * } * * @package core diff --git a/lib/classes/event/role_unassigned.php b/lib/classes/event/role_unassigned.php index 79928c31cac..bb788c2186d 100644 --- a/lib/classes/event/role_unassigned.php +++ b/lib/classes/event/role_unassigned.php @@ -35,7 +35,7 @@ defined('MOODLE_INTERNAL') || die(); * * - int id: role assigned id. * - string component: name of component. - * - int itemid: id of item. + * - int itemid: (optional) id of item. * } * * @package core diff --git a/lib/classes/event/user_graded.php b/lib/classes/event/user_graded.php index 9af099f4194..479b4ddd36c 100644 --- a/lib/classes/event/user_graded.php +++ b/lib/classes/event/user_graded.php @@ -36,8 +36,8 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about the event. * * - int itemid: grade item id. - * - bool overridden: Is this grade override? - * - float finalgrade: the final grade value. + * - bool overridden: (optional) Is this grade override? + * - float finalgrade: (optional) the final grade value. * } * * @package core diff --git a/lib/classes/event/user_list_viewed.php b/lib/classes/event/user_list_viewed.php index 09bfc9a0178..002fbfe2084 100644 --- a/lib/classes/event/user_list_viewed.php +++ b/lib/classes/event/user_list_viewed.php @@ -32,8 +32,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string courseshortname: the short name of course. - * - string coursefullname: the full name of course. + * - string courseshortname: (optional) the short name of course. + * - string coursefullname: (optional) the full name of course. * } * * @package core diff --git a/lib/classes/event/user_loggedout.php b/lib/classes/event/user_loggedout.php index e64d8724cfe..7131a5a38f7 100644 --- a/lib/classes/event/user_loggedout.php +++ b/lib/classes/event/user_loggedout.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string sessionid: session id. + * - string sessionid: (optional) session id. * } * * @package core diff --git a/lib/classes/event/user_profile_viewed.php b/lib/classes/event/user_profile_viewed.php index 277aa97cf85..d2541955606 100644 --- a/lib/classes/event/user_profile_viewed.php +++ b/lib/classes/event/user_profile_viewed.php @@ -32,9 +32,9 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - int courseid: id of course. - * - string courseshortname: shortname of course. - * - string coursefullname: fullname of course. + * - int courseid: (optional) id of course. + * - string courseshortname: (optional) shortname of course. + * - string coursefullname: (optional) fullname of course. * } * * @package core diff --git a/lib/classes/event/webservice_service_created.php b/lib/classes/event/webservice_service_created.php index c844c8aff89..6a64a6ee1c0 100644 --- a/lib/classes/event/webservice_service_created.php +++ b/lib/classes/event/webservice_service_created.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string sessionid: session id. + * - string sessionid: (optional) session id. * } * * @package core diff --git a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php index c186471c496..aae666be45b 100644 --- a/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php +++ b/mod/assign/submission/onlinetext/classes/event/assessable_uploaded.php @@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string format: content format. + * - string format: (optional) content format. * } * * @package assignsubmission_onlinetext diff --git a/mod/choice/classes/event/answer_submitted.php b/mod/choice/classes/event/answer_submitted.php index 3ef4025da76..905c17a1458 100644 --- a/mod/choice/classes/event/answer_submitted.php +++ b/mod/choice/classes/event/answer_submitted.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int choiceid: id of choice. - * - int optionid: id of option. + * - int optionid: (optional) id of option. * } * * @package mod_choice diff --git a/mod/choice/classes/event/answer_updated.php b/mod/choice/classes/event/answer_updated.php index cad67ef11cf..a5b04cdac98 100644 --- a/mod/choice/classes/event/answer_updated.php +++ b/mod/choice/classes/event/answer_updated.php @@ -33,7 +33,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int choiceid: id of choice. - * - int optionid: id of option. + * - int optionid: (optional) id of option. * } * * @package mod_choice diff --git a/mod/glossary/classes/event/entry_created.php b/mod/glossary/classes/event/entry_created.php index 4942c8879dc..98387f8ec0a 100644 --- a/mod/glossary/classes/event/entry_created.php +++ b/mod/glossary/classes/event/entry_created.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string concept: the concept of created entry. + * - string concept: (optional) the concept of created entry. * } * * @package mod_glossary diff --git a/mod/glossary/classes/event/entry_deleted.php b/mod/glossary/classes/event/entry_deleted.php index 1cef820c76d..f116600a8be 100644 --- a/mod/glossary/classes/event/entry_deleted.php +++ b/mod/glossary/classes/event/entry_deleted.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string concept: the concept of deleted entry. + * - string concept: (optional) the concept of deleted entry. * - string mode: (optional) view mode user was in before deleting entry. * - int|string hook: (optional) hook parameter in the previous view mode. * } diff --git a/mod/glossary/classes/event/entry_updated.php b/mod/glossary/classes/event/entry_updated.php index 9554c99138c..ea831fd59f8 100644 --- a/mod/glossary/classes/event/entry_updated.php +++ b/mod/glossary/classes/event/entry_updated.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string concept: the concept of updated entry (after update). + * - string concept: (optional) the concept of updated entry (after update). * } * * @package mod_glossary diff --git a/mod/quiz/classes/event/attempt_abandoned.php b/mod/quiz/classes/event/attempt_abandoned.php index 02e5ac389b4..08e56076388 100644 --- a/mod/quiz/classes/event/attempt_abandoned.php +++ b/mod/quiz/classes/event/attempt_abandoned.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int submitterid: id of submitter (null when trigged by CLI script). - * - int quizid: id of the quiz. + * - int quizid: (optional) id of the quiz. * } * * @package mod_quiz diff --git a/mod/quiz/classes/event/attempt_becameoverdue.php b/mod/quiz/classes/event/attempt_becameoverdue.php index 412ec198123..5318048ea12 100644 --- a/mod/quiz/classes/event/attempt_becameoverdue.php +++ b/mod/quiz/classes/event/attempt_becameoverdue.php @@ -34,7 +34,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int submitterid: id of submitter (null when trigged by CLI script). - * - int quizid: the id of the quiz. + * - int quizid: (optional) the id of the quiz. * } * * @package mod_quiz diff --git a/mod/quiz/classes/event/attempt_submitted.php b/mod/quiz/classes/event/attempt_submitted.php index 5de691e29b4..b64a967b345 100644 --- a/mod/quiz/classes/event/attempt_submitted.php +++ b/mod/quiz/classes/event/attempt_submitted.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event. * * - int submitterid: id of submitter (null when trigged by CLI script). - * - int quizid: the id of the quiz. + * - int quizid: (optional) the id of the quiz. * } * * @package mod_quiz diff --git a/mod/scorm/classes/event/sco_launched.php b/mod/scorm/classes/event/sco_launched.php index d3acb1c5f49..62c0de877e7 100644 --- a/mod/scorm/classes/event/sco_launched.php +++ b/mod/scorm/classes/event/sco_launched.php @@ -32,7 +32,7 @@ defined('MOODLE_INTERNAL') || die(); * Extra information about event properties. * * - string loadedcontent: A reference to the content loaded. - * - int instanceid: Instance id of the scorm activity. + * - int instanceid: (optional) Instance id of the scorm activity. * } * * @package mod_scorm diff --git a/mod/wiki/classes/event/page_locks_deleted.php b/mod/wiki/classes/event/page_locks_deleted.php index 6295699f50b..991c8e42464 100644 --- a/mod/wiki/classes/event/page_locks_deleted.php +++ b/mod/wiki/classes/event/page_locks_deleted.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - int section: section id. + * - int section: (optional) section id. * } * * @package mod_wiki diff --git a/mod/wiki/classes/event/page_updated.php b/mod/wiki/classes/event/page_updated.php index f6491bbf448..ab792b4ad93 100644 --- a/mod/wiki/classes/event/page_updated.php +++ b/mod/wiki/classes/event/page_updated.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about event. * - * - string newcontent: updated content. + * - string newcontent: (optional) updated content. * } * * @package mod_wiki diff --git a/mod/workshop/classes/event/submission_assessed.php b/mod/workshop/classes/event/submission_assessed.php index 57ccf640927..94dda7002a4 100644 --- a/mod/workshop/classes/event/submission_assessed.php +++ b/mod/workshop/classes/event/submission_assessed.php @@ -31,8 +31,8 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * - int workshopid: Workshop ID. * - int submissionid: Submission ID. + * - int workshopid: (optional) Workshop ID. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_created.php b/mod/workshop/classes/event/submission_created.php index 97564c5553f..928eb566631 100644 --- a/mod/workshop/classes/event/submission_created.php +++ b/mod/workshop/classes/event/submission_created.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * - string submissiontitle: Submission title. + * - string submissiontitle: (optional) Submission title. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_reassessed.php b/mod/workshop/classes/event/submission_reassessed.php index c66a8fc8619..30b5967b10f 100644 --- a/mod/workshop/classes/event/submission_reassessed.php +++ b/mod/workshop/classes/event/submission_reassessed.php @@ -31,9 +31,9 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * - int workshopid: Workshop ID. * - int submissionid: Submission ID. - * - float grade: Assessment grade. + * - int workshopid: (optional) Workshop ID. + * - float grade: (optional) Assessment grade. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_updated.php b/mod/workshop/classes/event/submission_updated.php index 8275ded6731..cb727fb4e21 100644 --- a/mod/workshop/classes/event/submission_updated.php +++ b/mod/workshop/classes/event/submission_updated.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * - string submissiontitle: Submission title. + * - string submissiontitle: (optional) Submission title. * } * * @package mod_workshop diff --git a/mod/workshop/classes/event/submission_viewed.php b/mod/workshop/classes/event/submission_viewed.php index ffe6013279e..eac6caee2f1 100644 --- a/mod/workshop/classes/event/submission_viewed.php +++ b/mod/workshop/classes/event/submission_viewed.php @@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die(); * @property-read array $other { * Extra information about the event. * - * - int workshopid: workshop ID. + * - int workshopid: (optional) workshop ID. * } * * @package mod_workshop