diff --git a/admin/tool/customlang/cli/import.php b/admin/tool/customlang/cli/import.php index 4daff057fdf..492e466b7ae 100644 --- a/admin/tool/customlang/cli/import.php +++ b/admin/tool/customlang/cli/import.php @@ -160,6 +160,16 @@ foreach ($langfiles as $lng => $files) { cli_heading(get_string('clifiles', 'tool_customlang', $lng)); + // If we intend to check in any changes, we must first check them out. + if ($checkin) { + cli_writeln(get_string('checkout', 'tool_customlang')); + + $progressbar = new progress_bar(); + $progressbar->create(); + + tool_customlang_utils::checkout($lng, $progressbar); + } + foreach ($files as $file) { // Generate a valid stored_file from this file. $record = (object)[ diff --git a/admin/tool/customlang/locallib.php b/admin/tool/customlang/locallib.php index 1e7f696e7ac..b4c8c397c18 100644 --- a/admin/tool/customlang/locallib.php +++ b/admin/tool/customlang/locallib.php @@ -89,7 +89,9 @@ class tool_customlang_utils { * @param progress_bar $progressbar optionally, the given progress bar can be updated */ public static function checkout($lang, progress_bar $progressbar = null) { - global $DB; + global $DB, $CFG; + + require_once("{$CFG->libdir}/adminlib.php"); // For behat executions we are going to load only a few components in the // language customisation structures. Using the whole "en" langpack is