8000 [DI] Fix hardcoded cache dir for warmups · symfony/symfony@ad9d359 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad9d359

Browse files
[DI] Fix hardcoded cache dir for warmups
1 parent b9a2e21 commit ad9d359

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public function dump(array $options = array())
241241
'container.build_hash' => '$hash',
242242
'container.build_id' => '$id',
243243
'container.build_time' => $time,
244-
));
244+
), __DIR__.DIRECTORY_SEPARATOR.'Container{$hash}');
245245
246246
EOF;
247247
} else {
@@ -963,7 +963,7 @@ public function __construct()
963963
964964
EOF;
965965
if (null !== $this->targetDirRegex) {
966-
$dir = $this->asFiles ? '$this->targetDirs[0] = \\dirname(__DIR__)' : '__DIR__';
966+
$dir = $this->asFiles ? '$this->targetDirs[0] = \\dirname($dir)' : '__DIR__';
967967
$code .= <<<EOF
968968
\$dir = {$dir};
969969
for (\$i = 1; \$i <= {$this->targetDirMaxMatches}; ++\$i) {
@@ -974,7 +974,7 @@ public function __construct()
974974
}
975975
if ($this->asFiles) {
976976
$code = str_replace('$parameters', "\$buildParameters;\n private \$parameters", $code);
977-
$code = str_replace('__construct()', '__construct(array $buildParameters = array())', $code);
977+
$code = str_replace('__construct()', '__construct(array $buildParameters = array(), $dir = __DIR__)', $code);
978978
$code .= " \$this->buildParameters = \$buildParameters;\n";
979979
}
980980

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_as_files.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,9 @@ class ProjectServiceContainer extends Container
280280
private $parameters;
281281
private $targetDirs = array();
282282

283-
public function __construct(array $buildParameters = array())
283+
public function __construct(array $buildParameters = array(), $dir = __DIR__)
284284
{
285-
$dir = $this->targetDirs[0] = \dirname(__DIR__);
285+
$dir = $this->targetDirs[0] = \dirname($dir);
286286
for ($i = 1; $i <= 5; ++$i) {
287287
$this->targetDirs[$i] = $dir = \dirname($dir);
288288
}
@@ -502,6 +502,6 @@ return new \Container%s\ProjectServiceContainer(array(
502502
'container.build_hash' => '%s',
503503
'container.build_id' => '%s',
504504
'container.build_time' => %d,
505-
));
505+
), __DIR__.DIRECTORY_SEPARATOR.'Container%s');
506506

507507
)

0 commit comments

Comments
 (0)
0