Skip to content

Commit cc59bc7

Browse files
Merge branch '4.4' into 5.0
* 4.4: [DI] Fix EnvVar not loaded when Loader requires an env var Fixed #34713 Move new messages to intl domain when possible [FrameworkBundle] Fix small typo in output comment chown and chgrp should also accept int as owner and group Revert "Fixed translations file dumper behavior" Fix RememberMe with null password [Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages Set booted flag to false when test kernel is unset [FrameworkBundle] remove messenger cache if not enabled [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code [HttpClient] Fix strict parsing of response status codes fix PHP const mapping keys using the inline notation [SecurityBundle] Drop duplicated code [FrameworkBundle] Make sure one can use fragments.hinclude_default_template Fix that no-cache requires positive validation with the origin, even for fresh responses Improve upgrading instructions for deprecated router options [DI] Suggest typed argument when binding fails with untyped argument
2 parents 0529352 + 4278493 commit cc59bc7

12 files changed

+85
-1
lines changed

Command/SecretsListCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
101101
(new SymfonyStyle($input, $output))
102102
->table(['Secret', 'Value'] + (null !== $localSecrets ? [2 => 'Local Value'] : []), $rows);
103103

104-
$io->comment("Local values override secret values.\nUse <info>secrets:set --local</info> to defined them.");
104+
$io->comment("Local values override secret values.\nUse <info>secrets:set --local</info> to define them.");
105105

106106
return 0;
107107
}

Command/TranslationUpdateCommand.php

+19
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
use Symfony\Component\Translation\Catalogue\TargetOperation;
2424
use Symfony\Component\Translation\Extractor\ExtractorInterface;
2525
use Symfony\Component\Translation\MessageCatalogue;
26+
use Symfony\Component\Translation\MessageCatalogueInterface;
2627
use Symfony\Component\Translation\Reader\TranslationReaderInterface;
2728
use Symfony\Component\Translation\Writer\TranslationWriterInterface;
2829

@@ -216,6 +217,24 @@ protected function execute(InputInterface $input, OutputInterface $output): int
216217

217218
$resultMessage = 'Translation files were successfully updated';
218219

220+
// move new messages to intl domain when possible
221+
if (class_exists(\MessageFormatter::class)) {
222+
foreach ($operation->getDomains() as $domain) {
223+
$intlDomain = $domain.MessageCatalogueInterface::INTL_DOMAIN_SUFFIX;
224+
$newMessages = $operation->getNewMessages($domain);
225+
226+
if ([] === $newMessages || ([] === $currentCatalogue->all($intlDomain) && [] !== $currentCatalogue->all($domain))) {
227+
continue;
228+
}
229+
230+
$result = $operation->getResult();
231+
$allIntlMessages = $result->all($intlDomain);
232+
$currentMessages = array_diff_key($newMessages, $result->all($domain));
233+
$result->replace($currentMessages, $domain);
234+
$result->replace($allIntlMessages + $newMessages, $intlDomain);
235+
}
236+
}
237+
219238
// show compiled list of messages
220239
if (true === $input->getOption('dump-messages')) {
221240
$extractedMessagesCount = 0;

DependencyInjection/FrameworkExtension.php

+1
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ public function load(array $configs, ContainerBuilder $container)
311311
$container->removeDefinition('console.command.messenger_failed_messages_retry');
312312
$container->removeDefinition('console.command.messenger_failed_messages_show');
313313
$container->removeDefinition('console.command.messenger_failed_messages_remove');
314+
$container->removeDefinition('cache.messenger.restart_workers_signal');
314315
}
315316

316317
if ($this->httpClientConfigEnabled = $this->isConfigEnabled($container, $config['http_client'])) {

Resources/config/schema/symfony-1.0.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@
412412
<xsd:element name="bus" type="messenger_bus" minOccurs="0" maxOccurs="unbounded" />
413413
</xsd:sequence>
414414
<xsd:attribute name="default-bus" type="xsd:string" />
415+
<xsd:attribute name="enabled" type="xsd:boolean" />
415416
</xsd:complexType>
416417

417418
<xsd:complexType name="messenger_serializer">

Test/KernelTestCase.php

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ protected function tearDown(): void
4343
{
4444
static::ensureKernelShutdown();
4545
static::$kernel = null;
46+
static::$booted = false;
4647
}
4748

4849
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'fragments' => [
5+
'enabled' => true,
6+
'hinclude_default_template' => 'global_hinclude_template',
7+
],
8+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
'messenger' => false,
5+
]);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:fragments enabled="true" hinclude-default-template="global_hinclude_template"/>
10+
</framework:config>
11+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
<framework:messenger enabled="false" />
10+
</framework:config>
11+
</container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
framework:
2+
fragments:
3+
enabled: true
4+
hinclude_default_template: global_hinclude_template
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
framework:
2+
messenger: false

Tests/DependencyInjection/FrameworkExtensionTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ public function testEsiDisabled()
159159
$this->assertFalse($container->hasDefinition('esi'));
160160
}
161161

162+
public function testFragmentsAndHinclude()
163+
{
164+
$container = $this->createContainerFromFile('fragments_and_hinclude');
165+
$this->assertTrue($container->hasParameter('fragment.renderer.hinclude.global_template'));
166+
$this->assertEquals('global_hinclude_template', $container->getParameter('fragment.renderer.hinclude.global_template'));
167+
}
168+
162169
public function testSsi()
163170
{
164171
$container = $this->createContainerFromFile('full');
@@ -565,9 +572,23 @@ public function testWebLink()
565572
$this->assertTrue($container->hasDefinition('web_link.add_link_header_listener'));
566573
}
567574

575+
public function testMessengerServicesRemovedWhenDisabled()
576+
{
577+
$container = $this->createContainerFromFile('messenger_disabled');
578+
$this->assertFalse($container->hasDefinition('console.command.messenger_consume_messages'));
579+
$this->assertFalse($container->hasDefinition('console.command.messenger_debug'));
580+
$this->assertFalse($container->hasDefinition('console.command.messenger_stop_workers'));
581+
$this->assertFalse($container->hasDefinition('console.command.messenger_setup_transports'));
582+
$this->assertFalse($container->hasDefinition('console.command.messenger_failed_messages_retry'));
583+
$this->assertFalse($container->hasDefinition('console.command.messenger_failed_messages_show'));
584+
$this->assertFalse($container->hasDefinition('console.command.messenger_failed_messages_remove'));
585+
$this->assertFalse($container->hasDefinition('cache.messenger.restart_workers_signal'));
586+
}
587+
568588
public function testMessenger()
569589
{
570590
$container = $this->createContainerFromFile('messenger');
591+
$this->assertTrue($container->hasDefinition('console.command.messenger_consume_messages'));
571592
$this->assertTrue($container->hasAlias('messenger.default_bus'));
572593
$this->assertTrue($container->getAlias('messenger.default_bus')->isPublic());
573594
$this->assertTrue($container->hasDefinition('messenger.transport.amqp.factory'));

0 commit comments

Comments
 (0)