mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-83757 core: Force DI to use global DB instead of scoped
This commit is contained in:
parent
07881a5772
commit
e17dd3bf62
@ -84,7 +84,7 @@ class di {
|
||||
* @return ContainerInterface
|
||||
*/
|
||||
protected static function create_container(): ContainerInterface {
|
||||
global $CFG, $DB;
|
||||
global $CFG;
|
||||
|
||||
// PHP Does not support function autoloading. We must manually include the file.
|
||||
require_once("{$CFG->libdir}/php-di/php-di/src/functions.php");
|
||||
@ -113,7 +113,11 @@ class di {
|
||||
\core\hook\manager::class => $hookmanager,
|
||||
|
||||
// The database.
|
||||
\moodle_database::class => $DB,
|
||||
\moodle_database::class => function(): \moodle_database {
|
||||
global $DB;
|
||||
|
||||
return $DB;
|
||||
},
|
||||
|
||||
// The string manager.
|
||||
\core_string_manager::class => fn() => get_string_manager(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user