Unfortunately PHP does not provide any means to autoload the files that
a functions is located in, even if they are in an namespace.
To work around this, Composer makes use of an `autoload.files` section
in the `composer.json` file. Shortly after the Composer autoloader is
registered with the `spl_autoload_register` call it also includes any
files listed in this section.
Moodle does not do this and really we should be doing so.
This change adds a section to the autoloader registration method which
loads all of the files defined in any third-party library included in
our `lib` directory which contains any `composer.json` file with such a
stanza.
This commit:
- introduces a \tests\ sub-namespace for use in unit tests only
- the path to this the tests/classes directory of the owning parent
- files here are excluded from unit test runs
This is agreed per policy in MDL-80855.
Including any empty directories, which would cause validation to
subsequently fail when they were skipped.
Co-authored-by: Leon Stringer <leon.stringer@ntlworld.com>
There are inherent issues with task blocking which mean that it has
never worked properly. It is also very buggy and can lead to massive
performance issues with task processing.
It is almost impossible to deprecate this in a staged fashion because
various APIs use the methods and it is not possible to determine which
are API uses and which are other valid uses.
In reality there has been little-to-no uptake on the use of this feature
and it should just be removed.
If $CFG->enable_read_only_sessions_debug was not enabled, debugging could be
enabled part-way through a request when restart_with_write_lock was
called. This meant that a diff between the initial and final session
would be made during write_close(), although the intial session state
was never captured. This generated false positives in the logs, and it
thought any variable set in the session was a change from the original
value.
This ensures that debugging is enabled before the debug flag is allowed
to change, preventing false positives.
Also added @runInSeparateProcess on each session Redis cluster test to let the test run
in a separate process to avoid the error "the headers are not already sent" by PHPUnit.
The original implementation of group filtering introduced in MDL-80565
assumed that the log table existed in Moodle's own database. This is not
the case of the database logstore, or any similar logstore implemetning
the database \core\log\sql_reader interface.
Furthermore this check was also applying the SQL when the user had the
`accessallgroups` capability, or when the course was not in SEPARATE
groups mode (no groupmode and/or visible groups).
Co-authored: Laurent David <laurent.david@moodle.com>