MDL-47162 core_message: debug whenever courseid is missing

Instead of silently defaulting to SITEID when courseid (coming
from message_send()/\core\message\manager::send_message()) is missing,
now a debugging message is shown to allow developers to fix their
messages to, always, include courseid.

Raw creation of events via message_sent::create() missing other[courseid]
leads to coding exception since now (there shouldn't be any legacy use, as far as
they are always created via create_from_ids() when sending a message.

Updated upgrade.txt notes a little bit, added references the 3.6 final
deprecation issue (MDL-55449) and covered with unit tests.
This commit is contained in:
Eloy Lafuente (stronk7) 2016-10-28 00:06:31 +02:00
parent 9d0e8a4f6d
commit a29bcf7819
5 changed files with 78 additions and 5 deletions

View file

@ -119,8 +119,12 @@ information provided here is intended especially for developers.
* Webservice function mod_assign_get_submissions returns a new field 'gradingstatus' from each submission.
* The return signature for the antivirus::scan_file() function has changed.
The calling function will now handle removal of infected files from Moodle based on the new integer return value.
* The first parameter $eventdata of \core\manager::send_message() should be \core\message. Use of \stdClass is depecated.
* message_sent::create_from_ids has an additional required parameter $courseid with a default value of SITEID.
* The first parameter $eventdata of both message_send() and \core\message\manager::send_message() should
be \core\message\message. Use of stdClass is deprecated.
* The message_sent event now expects other[courseid] to be always set, exception otherwise. For BC with contrib code,
message_sent::create_from_ids() will show a debugging notice if the \core\message\message being sent is missing
the courseid property, defaulting to SITEID automatically. In Moodle 3.6 (MDL-55449) courseid will be fully mandatory
for all messages sent.
=== 3.1 ===