MDL-72125 testing: Make global $CFG available when including generators

This will remove the requirement to add the global $CFG call to the top
of generator scripts.
This commit is contained in:
Andrew Nicols 2021-07-19 16:42:21 +08:00
parent 87b50a42e8
commit 46a5c75196

View File

@ -103,6 +103,9 @@ EOD;
* @return component_generator_base or rather an instance of the appropriate subclass.
*/
public function get_plugin_generator($component) {
// Note: This global is included so that generator have access to it.
// CFG is widely used in require statements.
global $CFG;
list($type, $plugin) = core_component::normalize_component($component);
$cleancomponent = $type . '_' . $plugin;
if ($cleancomponent != $component) {