Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit49aa562

Browse files
committed
Move command to TwigBundle and apply review suggestions
1 parent79cfa6e commit49aa562

File tree

15 files changed

+240
-245
lines changed

15 files changed

+240
-245
lines changed

‎src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ CHANGELOG
2121
* Add support for configuring multiple serializer instances via the configuration
2222
* Add support for`SYMFONY_TRUSTED_PROXIES`,`SYMFONY_TRUSTED_HEADERS`,`SYMFONY_TRUST_X_SENDFILE_TYPE_HEADER` and`SYMFONY_TRUSTED_HOSTS` env vars
2323
* Add`--no-fill` option to`translation:extract` command
24-
* Add`error:dump-pages` command
2524

2625
7.1
2726
---

‎src/Symfony/Bundle/FrameworkBundle/Command/ErrorDumpPagesCommand.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ public function load(array $configs, ContainerBuilder $container): void
222222
$loader->load('web.php');
223223
$loader->load('services.php');
224224
$loader->load('fragment_renderer.php');
225-
$loader->load('error.php');
226225
$loader->load('error_renderer.php');
227226

228227
if (!ContainerBuilder::willBeAvailable('symfony/clock', ClockInterface::class, ['symfony/framework-bundle'])) {

‎src/Symfony/Bundle/FrameworkBundle/Error/PagesDumper.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/console.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
useSymfony\Bundle\FrameworkBundle\Command\ContainerDebugCommand;
2626
useSymfony\Bundle\FrameworkBundle\Command\ContainerLintCommand;
2727
useSymfony\Bundle\FrameworkBundle\Command\DebugAutowiringCommand;
28-
useSymfony\Bundle\FrameworkBundle\Command\ErrorDumpPagesCommand;
2928
useSymfony\Bundle\FrameworkBundle\Command\EventDispatcherDebugCommand;
3029
useSymfony\Bundle\FrameworkBundle\Command\RouterDebugCommand;
3130
useSymfony\Bundle\FrameworkBundle\Command\RouterMatchCommand;
@@ -152,12 +151,6 @@
152151
])
153152
->tag('console.command')
154153

155-
->set('console.command.error_dump_pages', ErrorDumpPagesCommand::class)
156-
->args([
157-
service('error.pages_dumper'),
158-
])
159-
->tag('console.command')
160-
161154
->set('console.command.event_dispatcher_debug', EventDispatcherDebugCommand::class)
162155
->args([
163156
tagged_locator('event_dispatcher.dispatcher','name'),

‎src/Symfony/Bundle/FrameworkBundle/Resources/config/error.php

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/Tests/Error/PagesDumperTest.php

Lines changed: 0 additions & 87 deletions
This file was deleted.

‎src/Symfony/Bundle/FrameworkBundle/composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"symfony/uid":"^6.4|^7.0",
7373
"symfony/web-link":"^6.4|^7.0",
7474
"symfony/webhook":"^7.2",
75-
"symfony/webpack-encore-bundle":"^1.0|^2.0",
7675
"phpdocumentor/reflection-docblock":"^3.0|^4.0|^5.0",
7776
"twig/twig":"^3.12"
7877
},

‎src/Symfony/Bundle/TwigBundle/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.3
5+
---
6+
7+
* Add`error:dump` command
8+
49
7.1
510
---
611

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespaceSymfony\Bundle\TwigBundle\Command;
13+
14+
useSymfony\Bridge\Twig\ErrorRenderer\TwigErrorRenderer;
15+
useSymfony\Component\Console\Attribute\AsCommand;
16+
useSymfony\Component\Console\Command\Command;
17+
useSymfony\Component\Console\Input\InputInterface;
18+
useSymfony\Component\Console\Output\OutputInterface;
19+
useSymfony\Component\Console\Style\SymfonyStyle;
20+
useSymfony\Component\Filesystem\Filesystem;
21+
useSymfony\Component\HttpFoundation\Response;
22+
useSymfony\Component\HttpKernel\Exception\HttpException;
23+
useSymfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
24+
25+
/**
26+
* Dump error pages to plain html files that can be directly served by a web server.
27+
*
28+
* @author Loïck Piera <pyrech@gmail.com>
29+
*
30+
* @final
31+
*/
32+
#[AsCommand(
33+
name:'error:dump',
34+
description:'Dump error pages to plain html files that can be directly served by a web server',
35+
)]
36+
class ErrorDumpCommandextends Command
37+
{
38+
publicfunction__construct(
39+
privatereadonlystring$path,
40+
/** @var list<int> */
41+
privatereadonlyarray$statusCodes,
42+
privatereadonlyFilesystem$filesystem,
43+
privatereadonlyTwigErrorRenderer$twigErrorRenderer,
44+
privatereadonly ?EntrypointLookupInterface$entrypointLookup =null,
45+
) {
46+
parent::__construct();
47+
}
48+
49+
protectedfunctionexecute(InputInterface$input,OutputInterface$output):int
50+
{
51+
$io =newSymfonyStyle($input,$output);
52+
$io->title('Dumping error pages');
53+
54+
$this->dump();
55+
$io->success(\sprintf('Error pages have been dumped in "%s".',$this->path));
56+
57+
return Command::SUCCESS;
58+
}
59+
60+
publicfunctiondump():void
61+
{
62+
$statusCodes =$this->statusCodes;
63+
64+
if (!$statusCodes) {
65+
$statusCodes =array_filter(
66+
array_keys(Response::$statusTexts),
67+
fn ($statusCode) =>$statusCode >=400
68+
);
69+
}
70+
71+
$this->filesystem->remove($this->path);
72+
73+
foreach ($statusCodesas$statusCode) {
74+
// Avoid assets to be included only on the first dumped page
75+
$this->entrypointLookup?->reset();
76+
77+
$this->filesystem->dumpFile(
78+
$this->path.\DIRECTORY_SEPARATOR.$statusCode.'.html',
79+
$this->twigErrorRenderer->render(newHttpException((int)$statusCode))->getAsString()
80+
);
81+
}
82+
}
83+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp