(reverse-merged from commit 0d1e49d46838f6916f93561866fdd83beaf24a0f) This change was causing fatal errors on the course level, I am going to fix it myself.
This patch introduces new lib/pluginlib.php library that provides
unified access meta-information about all present plugin types. The
library defines plugin_manager singleton that in turn gathers
information about all present plugins and their status. The list of
plugins can be rendered either as plugins check table or plugins control
panel.
This makes print_plugins_table() function obsolete and because it is not
expected to be called by any contrib plugin, the function is removed.
CSS for the legacy table generated by print_plugins_table() is cleaned
up.
Internally, the new script modduplicate.php performs a single activity
backup and restore and then moves the newly created copy right below the
original.
The new class wraps some common coding patterns to install a language
pack via component_installer. Most notably it deals with the parental
dependency of the language packs.
The new class should also be the only place holding the information
about the location of language packs for the given Moodle version.
This allows profiling to be started earlier in the
setup.php execution, by configuring everything in
the config.php file. That way some interesting code
is also profiled, like DB connections, load of config records...
100% compatible with normal profiling and enabled via
special setting $CFG->earlyprofilingenabled
Example (to be put on config.php):
$CFG->earlyprofilingenabled = true;
$CFG->profilingautofrec = 3;
$CFG->profilingincluded = '/*';
$CFG->profilingallowme = true;
(to enable early profiling for 1/3 of any requests while also
allowing to use the PROFILEME PGC)
This includes refactoring to extract methods like sort_icon and show_hide_link which I think makes the code easier to read.
Note also the change to make_styles_string that makes it usable with html_writer. (Perhpas we need a css_writer classe ;-))
You may think that the extra validation is unnecessary, since the sort fields are already validated when the URL parameters are parsed, however that overlooks an important point. There may be other options that affect which columns are in the SQL, for example the quiz show individual question grades setting. These other options can cause a column that was in the table, and being sorted on, to disappear. Therefore, it is necessary to re-validate the sort columns when they are used, to make sure they are still present, otherwise you can get ORDER BY sql that refers to non-existant columns, which then causes DB errors.
Note that this change removes ->reseturl, This was supposed to be a way to reset all the session stuff relating to a table automatically in some situations, but from using Moodle and reading the code, I don't beleive it was working. The code was horrible and not easily fixible, and has been broken for years, so I just removed it.
This patch reimplements the internal cache that was used to store the
list of available translations in Moodle 1.x. By default, the method
get_list_of_translations() still uses the file
moodledata/cache/languages to store the list of available translations.
The location of that file can be redefined in config.php. The internal
format of the cache file is JSON now (used to be a plain text list).
The patch also fixes a usage of the global $CFG in translation_exists()
methods where the internal property should be used instead.