Skip to content

Commit

Permalink
bug #32958 [Mailer] Make the message logger permanent (fabpot)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Make the message logger permanent

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

4aeca4e [Mailer] made the message logger permanent
  • Loading branch information
fabpot committed Aug 5, 2019
2 parents 6205acf + 4aeca4e commit 233562f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Expand Up @@ -148,6 +148,7 @@ class FrameworkExtension extends Extension
private $annotationsConfigEnabled = false;
private $validatorConfigEnabled = false;
private $messengerConfigEnabled = false;
private $mailerConfigEnabled = false;

/**
* Responds to the app.config configuration parameter.
Expand Down Expand Up @@ -343,7 +344,7 @@ public function load(array $configs, ContainerBuilder $container)
$this->registerHttpClientConfiguration($config['http_client'], $container, $loader);
}

if ($this->isConfigEnabled($container, $config['mailer'])) {
if ($this->mailerConfigEnabled = $this->isConfigEnabled($container, $config['mailer'])) {
$this->registerMailerConfiguration($config['mailer'], $container, $loader);
}

Expand Down Expand Up @@ -553,6 +554,10 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
$loader->load('messenger_debug.xml');
}

if ($this->mailerConfigEnabled) {
$loader->load('mailer_debug.xml');
}

$container->setParameter('profiler_listener.only_exceptions', $config['only_exceptions']);
$container->setParameter('profiler_listener.only_master_requests', $config['only_master_requests']);

Expand Down Expand Up @@ -1965,9 +1970,6 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co
}

$loader->load('mailer.xml');
if ($container->getParameter('kernel.debug')) {
$loader->load('mailer_debug.xml');
}
$loader->load('mailer_transports.xml');
$container->getDefinition('mailer.default_transport')->setArgument(0, $config['dsn']);

Expand Down
Expand Up @@ -33,5 +33,9 @@
<argument /> <!-- recipients -->
<tag name="kernel.event_subscriber"/>
</service>

<service id="mailer.logger_message_listener" class="Symfony\Component\Mailer\EventListener\MessageLoggerListener">
<tag name="kernel.event_subscriber"/>
</service>
</services>
</container>
Expand Up @@ -5,10 +5,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<services>
<service id="mailer.logger_message_listener" class="Symfony\Component\Mailer\EventListener\MessageLoggerListener">
<tag name="kernel.event_subscriber"/>
</service>

<service id="mailer.data_collector" class="Symfony\Component\Mailer\DataCollector\MessageDataCollector">
<argument type="service" id="mailer.logger_message_listener" />
<tag name="data_collector" template="@WebProfiler/Collector/mailer.html.twig" id="mailer" />
Expand Down

0 comments on commit 233562f

Please sign in to comment.