merged branch WouterJ/ips_profiler_matcher (PR #8352)
This PR was submitted for the 2.3 branch but it was merged into the master branch instead (closes #8352). Discussion ---------- [Profiler] Support multiple IPs for matching | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | tbd As matching by IPs is introduced in 2.3, I request this for that version too. Not sure if that's the way it should be done Commits ------- efa4892 [Profiler] Support multiple IPs for matching
This commit is contained in:
commit
ef7eb96773
@ -1,6 +1,11 @@
|
|||||||
CHANGELOG
|
CHANGELOG
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
2.4.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
* allowed multiple IP addresses in profiler matcher settings
|
||||||
|
|
||||||
2.3.0
|
2.3.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
@ -149,13 +149,17 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('matcher')
|
->arrayNode('matcher')
|
||||||
->canBeUnset()
|
->canBeUnset()
|
||||||
->performNoDeepMerging()
|
->performNoDeepMerging()
|
||||||
|
->fixXmlConfig('ip')
|
||||||
->children()
|
->children()
|
||||||
->scalarNode('ip')->end()
|
|
||||||
->scalarNode('path')
|
->scalarNode('path')
|
||||||
->info('use the urldecoded format')
|
->info('use the urldecoded format')
|
||||||
->example('^/path to resource/')
|
->example('^/path to resource/')
|
||||||
->end()
|
->end()
|
||||||
->scalarNode('service')->end()
|
->scalarNode('service')->end()
|
||||||
|
->arrayNode('ips')
|
||||||
|
->beforeNormalization()->ifString()->then(function($v) { return array($v); })->end()
|
||||||
|
->prototype('scalar')->end()
|
||||||
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
@ -241,7 +241,7 @@ class FrameworkExtension extends Extension
|
|||||||
if (isset($config['matcher'])) {
|
if (isset($config['matcher'])) {
|
||||||
if (isset($config['matcher']['service'])) {
|
if (isset($config['matcher']['service'])) {
|
||||||
$container->setAlias('profiler.request_matcher', $config['matcher']['service']);
|
$container->setAlias('profiler.request_matcher', $config['matcher']['service']);
|
||||||
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path'])) {
|
} elseif (isset($config['matcher']['ip']) || isset($config['matcher']['path']) || isset($config['matcher']['ips'])) {
|
||||||
$definition = $container->register('profiler.request_matcher', 'Symfony\\Component\\HttpFoundation\\RequestMatcher');
|
$definition = $container->register('profiler.request_matcher', 'Symfony\\Component\\HttpFoundation\\RequestMatcher');
|
||||||
$definition->setPublic(false);
|
$definition->setPublic(false);
|
||||||
|
|
||||||
@ -249,6 +249,10 @@ class FrameworkExtension extends Extension
|
|||||||
$definition->addMethodCall('matchIp', array($config['matcher']['ip']));
|
$definition->addMethodCall('matchIp', array($config['matcher']['ip']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($config['matcher']['ips'])) {
|
||||||
|
$definition->addMethodCall('matchIps', array($config['matcher']['ips']));
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($config['matcher']['path'])) {
|
if (isset($config['matcher']['path'])) {
|
||||||
$definition->addMethodCall('matchPath', array($config['matcher']['path']));
|
$definition->addMethodCall('matchPath', array($config['matcher']['path']));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user