Explorar el Código

Add usage documentation and support for command line argument language in settings2csv script

Yannick Warnier hace 7 años
padre
commit
d201ed5490
Se han modificado 1 ficheros con 15 adiciones y 5 borrados
  1. 15 5
      tests/scripts/settings2csv.php

+ 15 - 5
tests/scripts/settings2csv.php

@@ -13,12 +13,22 @@
  * Init
  */
 // comment exit statement before executing
-//exit;
-$language = 'french';
-$_GET['language'] = $language;
-require __DIR__ . '/../../main/inc/global.inc.php';
+exit;
+
+/* Usage doc */
+if ($argc <= 1) {
+    echo 'Usage: php settings2csv.php [language]'.PHP_EOL;
+    echo '  Where the language name is supported by Chamilo. e.g. french, spanish, ...'.PHP_EOL;
+    echo '  (defaults to "english").'.PHP_EOL;
+    echo '  The resulting filepath will appear on the output line'.PHP_EOL.PHP_EOL;
+}
 
-$debug = 1;
+$language = 'english';
+if (!empty($argv[1])) {
+    $language = $argv[1];
+}
+$_GET['language'] = $language;
+@require __DIR__ . '/../../main/inc/global.inc.php';
 
 // Categories, in order of appearance in the Chamilo settings page
 // Check the end of main/admin/settings.php for the initial list