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