MDL-31540 Try to remove duplicates before storing LDAP search contexts

If the user specifies the same LDAP search context more than once,
when we sync users we retrieve the same set of users twice. When we
try to insert the "duplicated" user in the temp table again, the db
barfs and the db layer aborts the whole transaction.

So we try to detect and remove duplicates. This is a bit tricky (LDAP
is such a complex and wonderful protocol) as the contexts are
distinguished names and the matching/comparison rules are complex. But
assuming that we only use the attribute types used in 99.999% of the
distinguished names used for contexts out there (that is: dc, ou, cn,
o, l and c), and also assuming that the user is not using different
encodings/escapings for the same context, we can lower case the
contexts to compare them (and remove duplicates).

This is safe according to RFC-4517 (section 4.2.15. distinguishedNameMatch)
and RFC-4519 (where the EQUAILITY property is defined for the
different user application attribute types).

This shouldn't break any configuration that wasn't broken before :)

Signed-off-by: Iñaki Arenaza <iarenaza@mondragon.edu>
MDL-32009 messaging: Refator get_settings_url plugintype method

No need to duplicate checks since we have them in one place.
MDL-32009 messaging: Add is_enabled method to plugintype_message
MDL-32009 messaging: Add message processor uninstall functionality
MDL-32137 Fix message preference settings.

When a messaging output is set to forced, users should not be able to change
that. Regression intoroduced in bb3546f3 made possible to change checkboxes
(but not avoid forced settings). This fix replace checkboxes for 'forced'
settings with the corresponding message, similar to how it worked for
disallowed before.
MDL-31908 Glossary: entry list format- printable version does not show content
MDL-31711 Documentation : changed usages of @property to @var for non-magic variables.
MDL-32213 Question upgrade now correctly handles non-core manually-graded question types
MDL-32250 import latest SimpleTest 1.1.0
MDL-32201 question export: use qformat_xml::write_answer in base class

Without this, images in answers were not being written to the export
file for questions using extra_answer_fields.
MDL-32220 question import: files sometimes stored in the wrong context.

Sadly, this involves a small API change, but I don't believe anyone was
using the argument I had to remove (because we were sometimes passing a
wrong value, and there is not way to compute the right value at that
point in the code.)

Also sadly, the code to compute the context we are importing into is now
rather spaghetti-like, but it works.
MDL-32239 question bank: wrong cap checks editing/viewing quesitions

None of these problems affect the default roles. They only occur when
the permissions have been edited to allow restricted subsets of the
question capabilities.

In some cases, things that the restriced subset of capabilities should
have allowed were blocked by errors. In other cases, users were allowed
to do more than they should bave been due to failures to check the
right capabilities in the right places.

For full details, see the bug report.

Two of the bugs were previously reported separately as MDL-26395 and
MDL-27232.
MDL-32240 quiz editing: check permissions questions are added.

We also check permissions when removing questions from the quiz, so that
we do not let users make mistakes they cannot immediately undo.
MDL-32246 question export: should cope with unrecognised qtypes.

If a question is of an unrecognised type, then we just omit it from the export.
MDL-32251 E_STRICT fixes part 3
MDL-32256 quiz_cron() now returns true as expected by the current API
MDL-32258 database module does not have any data_cron() function to execute
MDL-32251 more E_STRCT fixes
MDL-32039 qeupgradehelper: fix typos in the lang strings
MDL-32265 moodlelib: Improved performance of moodle_needs_upgrading