GetTextTranslationHelper: Make sure we ignore any dotfile or vendor dir
If you are using composer, or ship any other code in dotfile or vendor directories, we should not parse that for translation. Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
parent
1a86c61c2d
commit
43423f9453
|
@ -467,10 +467,13 @@ class GettextTranslationHelper
|
|||
|
||||
$subdirs = array();
|
||||
while (($filename = readdir($directoryHandle)) !== false) {
|
||||
if ($filename[0] === '.' || $filename === 'vendor') {
|
||||
continue;
|
||||
}
|
||||
$filepath = $directory . DIRECTORY_SEPARATOR . $filename;
|
||||
if (preg_match('@^[^\.].+\.(' . implode('|', $this->sourceExtensions) . ')$@', $filename)) {
|
||||
$file->fwrite($filepath . PHP_EOL);
|
||||
} elseif (is_dir($filepath) && !preg_match('@^(\.|\.\.)$@', $filename)) {
|
||||
} elseif (is_dir($filepath)) {
|
||||
$subdirs[] = $filepath;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue