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:
Thomas Hochstein 2019-08-17 13:26:28 +02:00
parent 4327c432a5
commit 3d0410bacd

View File

@ -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,6 +34,7 @@ if (!$d) {
$const = array();
$const['checked'] = get_defined_constants();
try {
while(($file = readdir($d)) !== false) {
if ($file[0] == '.') {
continue;
@ -57,6 +59,10 @@ while(($file = readdir($d)) !== false) {
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;
@ -70,6 +76,10 @@ while(($file = readdir($d)) !== false) {
}
echo "\n";
}
} catch (Throwable $e) {
// Catch even fatal errors - we're just looking for constants
echo $e->getMessage();
}
$const['missing'] = array_filter($const['missing']);
echo "\n\nShowing missing constants:\n\n";