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

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:masterfromfabpot:root_dir-removal
Oct 16, 2018

Conversation

@fabpot
Copy link
Member

@fabpotfabpot commentedOct 10, 2018
edited
Loading

QA
Branch?master
Bug fix?no
New feature?no
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#24293
LicenseMIT
Doc PRn/a

* @param string $charset The charset
*/
publicfunction__construct($fileLinkFormat,string$rootDir,string$charset)
publicfunction__construct($fileLinkFormat,string$projectDir,string$charset)
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We already injectkernel.project_dir in the container definition.

@fabpotfabpotforce-pushed theroot_dir-removal branch 2 times, most recently from799ef32 to086826eCompareOctober 10, 2018 16:10
@ogizanagi
Copy link
Contributor

You meantkernel.root_dir :)

- Remove internal usage of kernel.project_dir when possible+ Remove internal usage of kernel.root_dir when possible

@fabpotfabpot changed the titleRemove internal usage of kernel.project_dir when possibleRemove internal usage of kernel.root_dir when possibleOct 10, 2018
@fabpot
Copy link
MemberAuthor

indeed, fixed

* @deprecated since Symfony 4.2
*/
protected$rootDir;
protected$projectDir;
Copy link
Member

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

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

of course, done


returnarray(
/**
* @deprecated since Symfony 3.3
Copy link
Member

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.

Copy link
MemberAuthor

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.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Moved to 4.2.

@fabpotfabpotforce-pushed theroot_dir-removal branch 4 times, most recently fromd8188bc to78416adCompareOctober 10, 2018 17:29
@fabpotfabpot changed the titleRemove internal usage of kernel.root_dir when possible[HttpKernel] Deprecate usage of getRootDir() and kernel.root_dirOct 10, 2018
@fabpot
Copy link
MemberAuthor

Ok, now with the deprecation of thegetRootDir() method.

publicfunctiongetCacheDir()
{
return$this->rootDir.'/cache/'.$this->environment;
return$this->getProjectDir().'/var/cache/'.$this->environment;
Copy link
MemberAuthor

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.

publicfunctiongetLogDir()
{
return$this->rootDir.'/logs';
return$this->getProjectDir().'/var/log';
Copy link
MemberAuthor

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.

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

fixes#24293

@fabpotfabpotforce-pushed theroot_dir-removal branch 2 times, most recently from11c7519 toefffda4CompareOctober 11, 2018 11:46
@nicolas-grekasnicolas-grekas added this to thenext milestoneOct 14, 2018
Copy link
Contributor

@ro0NLro0NL left a 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)

@ro0NL
Copy link
Contributor

ro0NL commentedOct 16, 2018
edited
Loading

@fabpot can you clarify why deprecatingKernel::getRootDir() but notKernelInterface::getRootDir(), this looks odd.

Do you aim to rename KernelInterface::getRootDir() to getProjectDir() on the interface?

edit: wait.. in 5.0KernelInterface::getRootDir() will return the project dir at implementation level i guess :) cool 👍

@fabpot
Copy link
MemberAuthor

@ro0NL It's more pragmatic than that :) As we are usinggetRootDir() in our own code (translation commands), having@deprecatedmeans that there is no way to be deprecation-free... unless I'm missing something of course.

@chalasr
Copy link
Member

IIRC the debug component mutes deprecations from the same vendor so implementing getRootDir() should keep the core deprecation free.@nicolas-grekas am I wrong?

@ro0NL
Copy link
Contributor

ro0NL commentedOct 16, 2018
edited
Loading

i was assuming the same yes :)

in 5.0 KernelInterface::getRootDir() will return the project dir at implementation level

should we actually consider this? Does it make sense? We could benefit from it, as we cant addgetProjectDir() to the interface. But this means another big step in 5.0 (basically favoringKernel::getRootDir() again instead ofgetProjectDir() 😂) Not sure it's worth it actually =/

But then we need to decide what's the purpose ofKernelInterface::getRootDir() in 5.0

chalasr reacted with thumbs up emoji

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 16, 2018
edited
Loading

IIRC the debug component mutes deprecations from the same vendor

I don't think so - that would prevent detecting when we use our own internal deprecated code actually.

5.0 KernelInterface::getRootDir() will return the project dir

no way, as you spotted :) in fact,getProjectDir() is used externally only once in the core, inAboutCommand. This means there is no need to have it on the interface to me.

we are using getRootDir() in our own code (translation commands),

how will this be implemented in 5.0?
do we want to deprecate using these folders?

@fabpot
Copy link
MemberAuthor

ThegetRootDir usages are for legacy directories that are not relevant in Symfony 4, that we need/can remove in 5.0.

@nicolas-grekas
Copy link
Member

nicolas-grekas commentedOct 16, 2018
edited
Loading

This means we need to trigger a deprecation whenever these dirs contain anything that we load currently, right?
Anyone willing to give it a try?

@fabpot
Copy link
MemberAuthor

It was not possible in 3.4, but we can definitely do it in 4.2.

@yceruto
Copy link
Member

We talking about these directories%kernel.root_dir%/Resources/views and%kernel.root_dir%/Resources/translations right? I can takeTwigBundle by now, maybe translations commands too.

nicolas-grekas reacted with thumbs up emojinicolas-grekas and ogizanagi reacted with heart emoji

@chalasr
Copy link
Member

@yceruto I already started the work for translation commands locally :)

yceruto and ro0NL reacted with thumbs up emoji

fabpot added a commit that referenced this pull requestOct 16, 2018
…() (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()
fabpot added a commit that referenced this pull requestOct 21, 2018
…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#10500go ahead with#28810 (comment)- [x] Fix testsCommits-------8b390f3 Deprecating support for legacy templates directories
fabpot added a commit that referenced this pull requestOct 27, 2018
…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        | TODOCommits-------acdece7 Deprecating support for legacy translations directory
Tobion added a commit that referenced this pull requestOct 31, 2018
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
@nicolas-grekasnicolas-grekas modified the milestones:next,4.2Nov 1, 2018
This was referencedNov 3, 2018
@fabpotfabpot deleted the root_dir-removal branchJanuary 14, 2019 11:01
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestApr 5, 2019
…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 renamedRef:symfony/symfony#28810 (comment)Commits-------2fcd9bc [Flex] Tell that `var/logs/` directory was renamed
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestNov 30, 2019
…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 docsAs persymfony/symfony#28810 $rootDir has been removed in 5.0 - use getProjectDir in docs instead - small change to be consistentCommits-------9da96e1 [minor] remove usage of Kernel::$rootDir from docs
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@stofstofstof left review comments

@OskarStarkOskarStarkOskarStark approved these changes

@chalasrchalasrchalasr left review comments

+1 more reviewer

@ro0NLro0NLro0NL left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

4.2

Development

Successfully merging this pull request may close these issues.

9 participants

@fabpot@ogizanagi@ro0NL@chalasr@nicolas-grekas@yceruto@stof@OskarStark@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp