check_parse_lang.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php /* For licensing terms, see /license.txt */
  2. /**
  3. * Script to check that no language file has parse errors.
  4. *
  5. * @package chamilo.cron.lang
  6. */
  7. /**
  8. * Includes and declarations.
  9. */
  10. //die();
  11. require_once '../../inc/global.inc.php';
  12. $path = api_get_path(SYS_LANG_PATH).'english';
  13. ini_set('memory_limit', '128M');
  14. /**
  15. * Main code.
  16. */
  17. $terms = [];
  18. $list = SubLanguageManager::get_lang_folder_files_list($path);
  19. $langs = scandir(api_get_path(SYS_LANG_PATH));
  20. foreach ($langs as $lang) {
  21. $dir = api_get_path(SYS_LANG_PATH).$lang;
  22. if (is_dir($dir) && substr($lang, 0, 1) != '.' && !empty($lang)) {
  23. echo "$lang...";
  24. $ok = true;
  25. foreach ($list as $entry) {
  26. $file = $dir.'/'.$entry;
  27. $out = [];
  28. if (is_file($file)) {
  29. //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true));
  30. @exec('php -l '.$file, $out);
  31. if (substr($out[0], 0, 2) != 'No') {
  32. echo $out[0]."\n";
  33. $ok = false;
  34. }
  35. }
  36. }
  37. if ($ok) {
  38. echo "OK\n";
  39. }
  40. }
  41. }
  42. echo "Done\n";