mirror of
https://github.com/moodle/moodle.git
synced 2025-07-25 00:02:18 +02:00
MDL-76129 upgrade: Allow caching in specific functions
During install/upgrade, caching is disabled. This change provides a way to temporarily enable caching (using in-memory cache storage only) within a specific function; caches are deleted afterwards. Adding this to two locations improves install performance quite a lot. Caching is not enabled during the parts of plugin installation that can vary for individual plugins (install.php/upgrade.php) as these might be relying on its absence, for example by making direct database changes.
This commit is contained in:
@@ -8852,6 +8852,10 @@ function admin_get_root($reload=false, $requirefulltree=true) {
|
||||
function admin_apply_default_settings($node=null, $unconditional=true, $admindefaultsettings=array(), $settingsoutput=array()) {
|
||||
$counter = 0;
|
||||
|
||||
// This function relies heavily on config cache, so we need to enable in-memory caches if it
|
||||
// is used during install when normal caching is disabled.
|
||||
$token = new \core_cache\allow_temporary_caches();
|
||||
|
||||
if (is_null($node)) {
|
||||
core_plugin_manager::reset_caches();
|
||||
$node = admin_get_root(true, true);
|
||||
|
Reference in New Issue
Block a user