check_parse_lang.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. $path = api_get_path(SYS_LANG_PATH).'english';
  12. ini_set('memory_limit','128M');
  13. /**
  14. * Main code
  15. */
  16. $terms = array();
  17. $list = SubLanguageManager::get_lang_folder_files_list($path);
  18. $langs = scandir(api_get_path(SYS_LANG_PATH));
  19. foreach ($langs as $lang) {
  20. $dir = api_get_path(SYS_LANG_PATH).$lang;
  21. if (is_dir($dir) && substr($lang,0,1) != '.' && !empty($lang)) {
  22. echo "$lang...";
  23. $ok = true;
  24. foreach ($list as $entry) {
  25. $file = $dir.'/'.$entry;
  26. $out = array();
  27. if (is_file($file)) {
  28. //$terms = array_merge($terms,SubLanguageManager::get_all_language_variable_in_file($file,true));
  29. @exec('php5 -l '.$file,$out);
  30. if (substr($out[0],0,2)!='No') {
  31. echo $out[0]."\n";
  32. $ok = false;
  33. }
  34. }
  35. }
  36. if ($ok) {
  37. echo "OK\n";
  38. }
  39. }
  40. }
  41. echo "Done\n";