-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[HttpKernel] Deprecate usage of getRootDir() and kernel.root_dir #28810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
fabpot
commented
Oct 10, 2018
•
edited
Loading
edited
Q | A |
---|---|
Branch? | master |
Bug fix? | no |
New feature? | no |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | #24293 |
License | MIT |
Doc PR | n/a |
* @param string $charset The charset | ||
*/ | ||
public function __construct($fileLinkFormat, string $rootDir, string $charset) | ||
public function __construct($fileLinkFormat, string $projectDir, string $charset) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already inject kernel.project_dir
in the container definition.
799ef32
to
086826e
Compare
You meant - Remove internal usage of kernel.project_dir when possible
+ Remove internal usage of kernel.root_dir when possible |
indeed, fixed |
086826e
to
ba17d16
Compare
protected $rootDir; | ||
protected $projectDir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the new property be private instead ? I don't think it needs to be an extension point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of course, done
@@ -572,6 +572,9 @@ protected function getKernelParameters() | |||
} | |||
|
|||
return array( | |||
/** | |||
* @deprecated since Symfony 3.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version looks wrong (otherwise, it would already be gone in 4.0).
And for that one, being able to warn when using the parameter looks useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
version is the right one, it was deprecated in 3.3, but we did not add the deprecation notice and didn't find time/energy/way to make it before 4.0. I can change to 4.2, no big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to 4.2.
d8188bc
to
78416ad
Compare
Ok, now with the deprecation of the |
@@ -360,15 +369,15 @@ public function getStartTime() | |||
*/ | |||
public function getCacheDir() | |||
{ | |||
return $this->rootDir.'/cache/'.$this->environment; | |||
return $this->getProjectDir().'/var/cache/'.$this->environment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default value in the Symfony Flex recipe.
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getLogDir() | ||
{ | ||
return $this->rootDir.'/logs'; | ||
return $this->getProjectDir().'/var/log'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the default value in the Symfony Flex recipe.
78416ad
to
5129d63
Compare
src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes #24293
11c7519
to
efffda4
Compare
efffda4
to
fb5688e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UPGRADE
files need to be updated
given the parameters are not deprecated in code (trigger error) i suggest a mention to manually search your code base
for UPGRADE-5.0 these should be listed as BC break (preferably put on top)
@fabpot can you clarify why deprecating Do you aim to rename KernelInterface::getRootDir() to getProjectDir() on the interface? edit: wait.. in 5.0 |
@ro0NL It's more pragmatic than that :) As we are using |
IIRC the debug component mutes deprecations from the same vendor so implementing getRootDir() should keep the core deprecation free. @nicolas-grekas am I wrong? |
i was assuming the same yes :)
should we actually consider this? Does it make sense? We could benefit from it, as we cant add But then we need to decide what's the purpose of |
I don't think so - that would prevent detecting when we use our own internal deprecated code actually.
no way, as you spotted :) in fact,
how will this be implemented in 5.0? |
The |
This means we need to trigger a deprecation whenever these dirs contain anything that we load currently, right? |
It was not possible in 3.4, but we can definitely do it in 4.2. |
We talking about these directories |
@yceruto I already started the work for translation commands locally :) |
…() (nicolas-grekas) This PR was merged into the 4.2-dev branch. Discussion ---------- [HttpKernel] fix deprecating KernelInterface::getRootDir() | Q | A | ------------- | --- | Branch? | 4.2 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Follow up of #28810. Did I get it right? Commits ------- 819f525 [HttpKernel] fix deprecating KernelInterface::getRootDir()
…directories (yceruto) This PR was merged into the 4.2-dev branch. Discussion ---------- [TwigBundle] Deprecating support for legacy templates directories | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | symfony/symfony-docs#10500 go ahead with #28810 (comment) - [x] Fix tests Commits ------- 8b390f3 Deprecating support for legacy templates directories
…lations directory (yceruto) This PR was merged into the 4.2-dev branch. Discussion ---------- [FrameworkBundle] Deprecating support for legacy translations directory | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #28810 (comment) | License | MIT | Doc PR | TODO Commits ------- acdece7 Deprecating support for legacy translations directory
This PR was merged into the 4.2-dev branch. Discussion ---------- [HttpKernel] Fix BC break in Kernel name | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | | License | MIT | Doc PR | Fix a BC break introduced by #28810 where the name of the kernel where change form the name of the folder containing the kernel class to the name of the folder containing the project. This introduced a bug with deployment processes where the cache warmup is done before moving the application to a folder with a different name and removing the possibility to compile the container (either by moving to a read-only filesystem or by removing the config directory). Commits ------- 872a772 Fix BC break in Kernel name
…sys) This PR was submitted for the master branch but it was merged into the 4.2 branch instead (closes #11299). Discussion ---------- [Flex] Tell that `var/logs/` directory was renamed Ref: symfony/symfony#28810 (comment) Commits ------- 2fcd9bc [Flex] Tell that `var/logs/` directory was renamed
…adzki) This PR was submitted for the 5.0 branch but it was squashed and merged into the 4.3 branch instead (closes #12719). Discussion ---------- [minor] remove usage of Kernel::$rootDir from docs As per symfony/symfony#28810 $rootDir has been removed in 5.0 - use getProjectDir in docs instead - small change to be consistent Commits ------- 9da96e1 [minor] remove usage of Kernel::$rootDir from docs