check_parse_lang.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php /* For licensing terms, see /license.txt */
  2. /**
  3. * Cron script to list unused, but defined, language variables
  4. * @package chamilo.cron.lang
  5. */
  6. /**
  7. * Includes and declarations
  8. */
  9. //die();
  10. require_once '../../inc/global.inc.php';
  11. require_once api_get_path(SYS_CODE_PATH).'admin/sub_language.class.php';
  12. $path = api_get_path(SYS_LANG_PATH).'english';
  13. ini_set('memory_limit','128M');
  14. /**
  15. * Main code
  16. */
  17. $terms = array();
  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 = array();
  28. if (is_file($file)) {
  29. //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true));
  30. @exec('php5 -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";