MDL-53260 upgrade: Option to display CLI upgrade messages in English
authorNadav Kavalerchik <nadavkav@gmail.com>
Thu, 10 Mar 2016 19:55:54 +0000 (21:55 +0200)
committerJun Pataleta <jun@moodle.com>
Mon, 21 Mar 2016 03:59:50 +0000 (11:59 +0800)
admin/cli/upgrade.php

index be2ba8b..cd26567 100644 (file)
@@ -49,13 +49,21 @@ list($options, $unrecognized) = cli_get_params(
     array(
         'non-interactive'   => false,
         'allow-unstable'    => false,
-        'help'              => false
+        'help'              => false,
+        'lang'              => 'en'
     ),
     array(
         'h' => 'help'
     )
 );
 
+global $SESSION;
+if ($options['lang']) {
+    $SESSION->lang = $options['lang'];
+} else {
+    $SESSION->lang = 'en';
+}
+
 $interactive = empty($options['non-interactive']);
 
 if ($unrecognized) {
@@ -74,6 +82,7 @@ Options:
 --non-interactive     No interactive questions or confirmations
 --allow-unstable      Upgrade even if the version is not marked as stable yet,
                       required in non-interactive mode.
+--lang=CODE           Set preferred language for CLI output, during upgrade process (default:en).
 -h, --help            Print out this help
 
 Example: