Also deprecated the following functions -
1. message_move_userfrom_unread2read - It is not necessary
for us to mark a message as read on user deletion.
2. message_get_blocked_users - Horrible logic used to
determine if a user is blocked via reference on some
randomly chosen 'isblocked' variable.
3. message_get_contacts - The same as above. This can be
done in a much nicer way.
4. message_mark_message_read - We want two functions to do
this to avoid confusing messages and notifications.
5. message_can_delete_message - This assumed the variable
$message contained the 'useridto' property, which
was present in the old table structure. We do not want
future usages where a query is done on the new table
and is simply passed as this won't contain this property.
6. message_delete_message - Same as above.
This change considers all existing search areas in Moodle and makes
necessary changes.
Custom change to course search, supported by helper in base.php:
* course/classes/search/mycourse.php
Custom change to message search:
* message/classes/search/message_received.php
* message/classes/search/message_sent.php
Custom change to user search:
* user/classes/search/user.php
Custom changes to module areas, supported by helper in base_mod.php:
* mod/book/classes/search/chapter.php
* mod/data/classes/search/entry.php
* mod/forum/classes/search/post.php
* mod/glossary/classes/search/entry.php
* mod/survey/classes/search/activity.php
* mod/wiki/classes/search/collaborative_page.php
(Note: the unit tests do not exhaustively check every context type
for these, given that's mainly handled by the helper function
which was already tested in the base_activity test.)
Handled by block base class (no change):
* blocks/html/classes/search/content.php
Handled by activity base class (no change):
* mod/assign/classes/search/activity.php
* mod/book/classes/search/activity.php
* mod/chat/classes/search/activity.php
* mod/choice/classes/search/activity.php
* mod/data/classes/search/activity.php
* mod/feedback/classes/search/activity.php
* mod/folder/classes/search/activity.php
* mod/forum/classes/search/activity.php
* mod/glossary/classes/search/activity.php
* mod/imscp/classes/search/activity.php
* mod/label/classes/search/activity.php
* mod/lesson/classes/search/activity.php
* mod/lti/classes/search/activity.php
* mod/page/classes/search/activity.php
* mod/quiz/classes/search/activity.php
* mod/resource/classes/search/activity.php
* mod/scorm/classes/search/activity.php
* mod/url/classes/search/activity.php
* mod/wiki/classes/search/activity.php
* mod/workshop/classes/search/activity.php
Make indexing of user messages tolerant to user deletion.
When creating the search document for user messages,
add a check to see if the user has been deleted in the
system. If they have been deleted abort creating the search
document.
This is to avoid rasining an error when trying to get the
user context for a deleted user.
The OR clause in these queries used different sets of columns to select
userid which meant that the indexes that included user id could not be
used.
This change splits the query so that each individual part can use one of
the indexes that includes a userid which speeds them up considerably.
If there was no conversation found and the method returned early, the
active transaction was not marked as committable and the error was
reported by the request shutdown handler.
Attaching a unit test for the case just because it did not seem to be
covered. I was trying to reproduce the thrown error in the unit test but
it can't be used in this case. The shutdown handler puts the warning
directly into the error_log and it is not guaranteed where such messages
go (depending on the PHP configuration). And we do not even raise it
during the unit test execution (presumably due to noise it would
produce) anyway.
I have broken up the single query that was doing multiple joins on the
messaging and user tables. It no longer does any joins and will instead
query each data set individually.
This may cost more in terms of PHP processing but it will mean that
standard database tunings should be able to handle larger data sets.
For example this function was taking a long time to run on moodle.org
and was causing the MySQL join buffer to overflow.
- No longer use the Fibonacci sequence for delaying the timeout.
It is too aggressive.
- The backoff_timer AMD module now expects the callback AND the
backoff function to be passed to the constructor.
- Added ability to specify polling frequency in config.php.
- Added helper function to return the cache key.
- Reworded the parameters for clarity.
Remove the HTML tags from any message in the message area when updating
the last message on the contact otherwise the styling breaks and also
allows <script> tags to be added to the page.
Stop the message area header and footer from being rendered if there is
no other user being messaged, otherwise notices are generated and the
messages fail to send.
Also -
1) Made note of the deprecation as well as the functions and
files that were removed earlier in upgrade.txt.
2) Added new functions to api.php to replace the deprecated ones
that were being used in unit tests.
3) Removed files that are no longer being used.