- Define sitepolicy handler manager class, base class and the core handler
- Allow to set a plugin as sitepolicyhandler that implements the sitepolicy API
- Modify web services to return information from the 3rd party handler instead of core if needed
The patch introduces a new site setting 'sitepolicyhandler' that can be
either empty or contain a plugin component name. If it is empty, the
site policy feature keeps working as before and the core keeps the
control over it.
If a plugin is specified, it is expected to implement the callback
'site_policy_handler' in its lib.php file. The callback should return a
URL to a script where the user can accept the site policies. The plugin
itself is responsible for setting the 'policyagreed' flag in the users
table. The callback may return an empty value, in which case the user
can continue using the site without being redirected.
The patch adds support for a new pre-config flag NO_SITEPOLICY_CHECK.
This constant should be defined and set to true if we should not check
the user's policyagreed status during the require_login().
This is for pages where the user actually accepts the site policies and
helps to avoid the redirect loop.
Prevent having multiple top question categories when deleting a course category.
This commit also fix the problem of question files' contexts not being updated when moving them.
These changes adjust the unit tests to compare known values rather than
calculating them on the fly.
The unit test against a 'bad' source has been modified to simply check
for the relevant exception as PHP prevents any output on exceptions
anyway.
The file sample_questions.xml from moodle-stack is properly formed.
The file sample_questions_wrong.xml has mismatching tags.
Comparison is performed with recursive array comparison.
Error messages and returned data structures are compared.
Call with: phpunit lib/tests/xmlize_test.php
Since version 2.7.3 the libxml library (https://bugs.php.net/bug.php?id=49660)
limits parsing in memory files to 10MB. Unfortunately the libxml option
LIBXML_PARSEHUGE to release the 10MB limit is not exposed to php. Through
using the sax parser which is typically used to parse directly from files but
instead chunking the string in memory xml files larger than 10MB can again
be parsed. I copied the exact behaviour of the previous routine
by Hans Anderson (http://www.hansanderson.com/contact/) so compatibility
should be maintained.