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 18:41:31 +08:00
parent 1858a98a22
commit fc457581a4
+3
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) {