diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 7d8ea2fb794..675ba261caa 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -6842,6 +6842,26 @@ function get_string_manager($forcereload=false) { $translist = explode(',', $CFG->langlist); } + if (!empty($CFG->config_php_settings['customstringmanager'])) { + $classname = $CFG->config_php_settings['customstringmanager']; + + if (class_exists($classname)) { + $implements = class_implements($classname); + + if (isset($implements['core_string_manager'])) { + $singleton = new $classname($CFG->langotherroot, $CFG->langlocalroot, $translist); + return $singleton; + + } else { + debugging('Unable to instantiate custom string manager: class '.$classname. + ' does not implement the core_string_manager interface.'); + } + + } else { + debugging('Unable to instantiate custom string manager: class '.$classname.' can not be found.'); + } + } + $singleton = new core_string_manager_standard($CFG->langotherroot, $CFG->langlocalroot, $translist); } else { diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 06b25b09b27..4cf6f2f26f9 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -24,6 +24,8 @@ information provided here is intended especially for developers. and sql_reader which use iterators to be more memory efficient. * $CFG->enabletgzbackups setting has been removed as now backups are stored internally using .tar.gz format by default, you can set $CFG->usezipbackups to store them in zip format. This does not affect the restore process, which continues accepting both. +* Added support for custom string manager implementations via $CFG->customstringmanager + directive in the config.php. See MDL-49361 for details. === 2.8 ===