diff --git a/app/Services/Rule/RuleFilter.php b/app/Services/Rule/RuleFilter.php index 6c463352..d1431838 100644 --- a/app/Services/Rule/RuleFilter.php +++ b/app/Services/Rule/RuleFilter.php @@ -100,53 +100,50 @@ function ($job, $mapping) { $mysgsValue = [$mysgsValue]; } - $matchedAtLeastOnce = false; foreach ($mysgsValue as $index => $mysgsValue_single) { if (empty($mysgsValue_single)) { continue; } - logger(sprintf('checking taxo %s for term "%s" against mysgs value: %s', + /*logger(sprintf('checking taxo "%s" for term "%s" against mysgs value: "%s"', $term->taxonomy->name, $termValue, print_r($mysgsValue_single, true)) - ); + );*/ if (!(Str::is($termValue, Str::lower($mysgsValue_single)) - || ( - isset($term->config['aliases']) - && in_array( - Str::lower($mysgsValue_single), - array_map('Str::lower', $term->config['aliases']) - ) + || (isset($term->config['aliases']) + && in_array( Str::lower($mysgsValue_single), + array_map('Str::lower', $term->config['aliases'])) ) )) { - logger(sprintf('rule %s dropped, term %s did not match with %s', + /*logger(sprintf('rule "%s": term "%s" did not match with "%s"', $rule->id, $termValue, $mysgsValue_single) - ); + );*/ $matched = false; } else { $matchedTaxonomies[$term->taxonomy->name] = true; - $matchedAtLeastOnce = true; - logger(sprintf('rule %s added, term %s matched with %s', + /*logger(sprintf('rule "%s": term "%s" matched with "%s"', $rule->id, $termValue, $mysgsValue_single) - ); + );*/ if (!in_array($term->name, $job_taxonomy_terms_matches[$term->taxonomy->name])) { $job_taxonomy_terms_matches[$term->taxonomy->name][] = $term->name; } } } - - $matched = ($matched || $matchedAtLeastOnce); } } } $taxonomyMatch = true; + //logger('$matchedTaxonomies: ' . print_r($matchedTaxonomies, true)); foreach ($matchedTaxonomies as $taxonomy => $state) { $taxonomyMatch &= $state; } if ($matched || $taxonomyMatch) { $clientRules[] = $rule; + logger(sprintf('rule %s added, matched=%b taxoMatch=%b ', + $rule->id, $matched, $taxonomyMatch) + ); } else { logger(sprintf('rule %s dropped, matched=%b taxoMatch=%b ', $rule->id, $matched, $taxonomyMatch) diff --git a/composer.json b/composer.json index f1e1a27a..09e9a16e 100644 --- a/composer.json +++ b/composer.json @@ -48,6 +48,7 @@ "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laracademy/generators": "^3.0", + "laravel/envoy": "^2.7", "laravel/sail": "^0.0.5", "laravel/telescope": "^4.4", "mockery/mockery": "^1.4.2", diff --git a/composer.lock b/composer.lock index ba89d17c..e3e4dc0d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b3d90d7d757a5c568d8bdde50bd8c1ce", + "content-hash": "1cd910acd5b5bf9d26fe02bbf420df2d", "packages": [ { "name": "asm89/stack-cors", @@ -12459,6 +12459,68 @@ }, "time": "2021-06-23T20:09:59+00:00" }, + { + "name": "laravel/envoy", + "version": "v2.7.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/envoy.git", + "reference": "29416ac1c19192506b7a35c922dcd011857a5d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/envoy/zipball/29416ac1c19192506b7a35c922dcd011857a5d25", + "reference": "29416ac1c19192506b7a35c922dcd011857a5d25", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0|^7.0", + "illuminate/support": "^6.0|^7.0|^8.0", + "php": "^7.2|^8.0", + "symfony/console": "^4.3|^5.0", + "symfony/process": "^4.3|^5.0" + }, + "require-dev": { + "phpunit/phpunit": "^8.0|^9.0" + }, + "suggest": { + "ext-posix": "Required to determine the System user on Unix systems." + }, + "bin": [ + "bin/envoy" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Envoy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylor@laravel.com" + } + ], + "description": "Elegant SSH tasks for PHP.", + "keywords": [ + "laravel", + "ssh" + ], + "support": { + "issues": "https://github.com/laravel/envoy/issues", + "source": "https://github.com/laravel/envoy/tree/v2.7.0" + }, + "time": "2021-03-30T21:09:10+00:00" + }, { "name": "laravel/sail", "version": "v0.0.5", @@ -14542,5 +14604,5 @@ "ext-json": "*" }, "platform-dev": [], - "plugin-api-version": "2.0.0" + "plugin-api-version": "2.1.0" }