Skip to content

Commit 9764046

Browse files
committed
Added language vars checker
1 parent 2074a68 commit 9764046

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

main/cron/lang/check_parse_lang.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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";

0 commit comments

Comments
 (0)