Merge pull request #2845 from Icinga/fix/translation-excludes

GetTextTranslationHelper: Make sure we ignore any dotfile or vendor dir
This commit is contained in:
lippserd 2017-11-08 09:53:54 +01:00 committed by GitHub
commit cc4fcaefad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -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_link($filepath) && is_dir($filepath)) {
$subdirs[] = $filepath;
}
}