plugin_lang.php: Check additional_plugins, too.
If you have the additional_plugins repo handy, you can just change the base path to check all that plugins, too. We shouldn't forget to check the UTF-8 directories. And we just have to catch all, even fatal, errors, due to missing function dependencies. Signed-off-by: Thomas Hochstein <thh@inter.net>
This commit is contained in:
parent
4327c432a5
commit
3d0410bacd
@ -25,6 +25,7 @@ if (!is_array($argv) || empty($argv[1])) {
|
||||
$lang = preg_replace('@[^a-z0-9]@', '', strtolower($argv[1]));
|
||||
echo "Probing language $lang\n";
|
||||
$base = '../plugins/';
|
||||
#$base = '../../additional_plugins';
|
||||
$d = @opendir($base);
|
||||
|
||||
if (!$d) {
|
||||
@ -33,42 +34,51 @@ if (!$d) {
|
||||
|
||||
$const = array();
|
||||
$const['checked'] = get_defined_constants();
|
||||
while(($file = readdir($d)) !== false) {
|
||||
if ($file[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_dir($base . '/' . $file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tfile = $base . '/' . $file . '/lang_en.inc.php';
|
||||
$sfile = $base . '/' . $file . '/lang_' . $lang . '.inc.php';
|
||||
try {
|
||||
while(($file = readdir($d)) !== false) {
|
||||
if ($file[0] == '.') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!is_dir($base . '/' . $file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tfile = $base . '/' . $file . '/lang_en.inc.php';
|
||||
$sfile = $base . '/' . $file . '/lang_' . $lang . '.inc.php';
|
||||
|
||||
if (file_exists($tfile)) {
|
||||
echo "Parsing english language from $file - ";
|
||||
include $tfile;
|
||||
$current = get_defined_constants();
|
||||
$const['native'][$file] = array_diff($current, $const['checked']);
|
||||
$const['checked'] = array_merge($const['checked'], $current);
|
||||
echo count($const['native'][$file]) . " constants.\n";
|
||||
} else {
|
||||
echo "NOTICE: English language of $file does not exist.\n\n";
|
||||
continue;
|
||||
if (file_exists($tfile)) {
|
||||
echo "Parsing english language from $file - ";
|
||||
include $tfile;
|
||||
$current = get_defined_constants();
|
||||
$const['native'][$file] = array_diff($current, $const['checked']);
|
||||
$const['checked'] = array_merge($const['checked'], $current);
|
||||
echo count($const['native'][$file]) . " constants.\n";
|
||||
} else {
|
||||
echo "NOTICE: English language of $file does not exist.\n\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for UTF-8 language files, too
|
||||
if (!file_exists($sfile)) {
|
||||
$sfile = $base . '/' . $file . '/UTF-8/lang_' . $lang . '.inc.php';
|
||||
}
|
||||
if (file_exists($sfile)) {
|
||||
echo "Parsing differences for $file - ";
|
||||
include $sfile;
|
||||
$current = get_defined_constants();
|
||||
$const['missing'][$file] = array_diff($current, $const['checked']);
|
||||
$const['checked'] = array_merge($const['checked'], $current);
|
||||
|
||||
echo count($const['missing'][$file]) . " missing constants.\n";
|
||||
} else {
|
||||
$const['missing'][$file] = $const['native'][$file];
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
if (file_exists($sfile)) {
|
||||
echo "Parsing differences for $file - ";
|
||||
include $sfile;
|
||||
$current = get_defined_constants();
|
||||
$const['missing'][$file] = array_diff($current, $const['checked']);
|
||||
$const['checked'] = array_merge($const['checked'], $current);
|
||||
|
||||
echo count($const['missing'][$file]) . " missing constants.\n";
|
||||
} else {
|
||||
$const['missing'][$file] = $const['native'][$file];
|
||||
}
|
||||
echo "\n";
|
||||
} catch (Throwable $e) {
|
||||
// Catch even fatal errors - we're just looking for constants
|
||||
echo $e->getMessage();
|
||||
}
|
||||
|
||||
$const['missing'] = array_filter($const['missing']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user