-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Use get_theme_file_path
function.
#3876
Conversation
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.
@spacedmonkey I think we should either leave this as is and continue to rely on the is_readable
logic, or we should consistently switch this to use file_exists
. Right now the PR here results in a mix of both which does not make sense to me.
I don't have a strong opinion either way. If there's no particular reason why the theme.json
related code started using is_readable
instead of file_exists
, I'd be onboard with changing this code to use get_theme_file_path()
, but then also consistently use file_exists
.
} | ||
|
||
$theme_has_support = is_readable( get_theme_file_path( 'theme.json' ) ); | ||
|
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.
Apparently there's some whitespace here that causes a PHPCS error?
I have include another commit, to also use the think of this use case.
|
Why
|
I recommend using I think using the I would like to unblock this, can I get a review of this. |
My main comment is that these changes should happen in Gutenberg first. This is something I have recurrently mentioned, and it takes time and energy for everyone. I feel I sound like a broken record. I'm sorry about that. Is there something I can do to clarify this, so nobody needs to waste energy/time on this again? |
For full transparency: other than I already commented back in February, I don't fully understand how this is impactful (performance, users, etc.). I feel others would be better equipped than I am to help figure this out. |
Can you point me in the direction of the documented process for this? @oandregal |
As far as I know, it has been good etiquette among people that work together, and it has been transmitted PR to PR in comments. I have been personally doing this for months, if not a year. I know @azaozz and @hellofromtonya have been sharing this as well in other channels, they will have more context as to where. I don't know that there is a handbook page anywhere that states this. I'm happy to help writing one down if that's useful to help us focus on solving user's problems. |
Following on from the above, is this process documented in a handbook yet? If there are files in core that need to be modified first in Gutenberg then ideally there should be a test that fails when they're modified in a core PR. |
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.
The logic looks good to me 👍
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.
Thanks for the PR @spacedmonkey! As your plan is to backport this to Gutenberg in this PR, everything looks good to me here - and nice one using is_readable()
over file_exists()
👍
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.
Thanks @spacedmonkey, LGTM!
Use
get_theme_file_path
function to stop replicated code.Trac ticket: https://core.trac.wordpress.org/ticket/57629
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.