Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Better naming for include and exclude paths/patterns #1550

Merged
merged 1 commit into from
Apr 24, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Neos.Flow/Classes/I18n/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ public function findBestMatchingLocale(Locale $locale)

/**
* Returns a regex pattern including enclosing characters, that matches any of the configured
* blacklist paths inside "Neos.Flow.i18n.scan.excludePatterns".
* exclude list configured inside "Neos.Flow.i18n.scan.excludePatterns".
*
* @return string The regex pattern matching the configured blacklist
* @return string The regex pattern matching the configured exclude list
*/
protected function getScanBlacklistPattern()
protected function getScanExcludePattern()
{
$pattern = implode('|', array_keys(array_filter((array)$this->settings['scan']['excludePatterns'])));
if ($pattern !== '') {
Expand Down Expand Up @@ -286,11 +286,11 @@ protected function getScanBlacklistPattern()
*/
protected function generateAvailableLocalesCollectionByScanningFilesystem()
{
$whitelistPaths = array_keys(array_filter((array)$this->settings['scan']['includePaths']));
if ($whitelistPaths === []) {
$includePaths = array_keys(array_filter((array)$this->settings['scan']['includePaths']));
if ($includePaths === []) {
return;
}
$blacklistPattern = $this->getScanBlacklistPattern();
$excludePattern = $this->getScanExcludePattern();

/** @var PackageInterface $activePackage */
foreach ($this->packageManager->getActivePackages() as $activePackage) {
Expand All @@ -301,7 +301,7 @@ protected function generateAvailableLocalesCollectionByScanningFilesystem()
}

$directories = [];
foreach ($whitelistPaths as $path) {
foreach ($includePaths as $path) {
$scanPath = Files::concatenatePaths(array($packageResourcesPath, $path));
if (is_dir($scanPath)) {
array_push($directories, Files::getNormalizedPath($scanPath));
Expand All @@ -311,7 +311,7 @@ protected function generateAvailableLocalesCollectionByScanningFilesystem()
while ($directories !== []) {
$currentDirectory = array_pop($directories);
$relativeDirectory = '/' . str_replace($packageResourcesPath, '', $currentDirectory);
if ($blacklistPattern !== '' && preg_match($blacklistPattern, $relativeDirectory) === 1) {
if ($excludePattern !== '' && preg_match($excludePattern, $relativeDirectory) === 1) {
continue;
}

Expand Down