Refactoring - wp-themes-inactive, wp-parent-theme & wp-active-theme#7507
Refactoring - wp-themes-inactive, wp-parent-theme & wp-active-theme#7507apermo wants to merge 4 commits intoWordPress:trunkfrom
Conversation
'wp-active-theme' => self::get_wp_active_theme(), 'wp-parent-theme' => self::get_wp_parent_theme(), 'wp-themes-inactive' => self::get_wp_themes_inactive(),
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Github's diffing utility is having a hard time with this patch. For those wanting to review it, I encourage using an external diff tool, or change the algorithm with |
|
@apermo I pushed a commit with a few changes. I would appreciate your review of two in particular:
|
| return array( | ||
| 'label' => __( 'Parent Theme' ), | ||
| 'fields' => array(), | ||
| ); |
There was a problem hiding this comment.
are you sure adding this redundancy is beneficial?
There was a problem hiding this comment.
the thought behind the early-abort is to avoid mistakes based on humans needing to continue parsing the function. before this was extracted it was pre-set to be an array() and the if was purely additive. now, with the logic localized, we have to do something affirmative in each branch.
I don't see any one solution purely dominant here. the redundancy doesn't bother me at all, and I tend to be more concerned about if complexity. either way, I've reverted this change for a different fix in 276de8b which pre-sets the $fields = array() var so it's not unset when returning
| if ( $parent_theme ) { | ||
| $parent_theme_version = $parent_theme->version; | ||
| $parent_theme_version_debug = $parent_theme_version; | ||
| if ( ! $parent_theme ) { |
There was a problem hiding this comment.
If you want to keep this early return, I'd vote for a stronger condition. ->parent() will return false
So unless you opt to remove it. How about:
if ( $parent_theme === false ) {
There was a problem hiding this comment.
I've replaced the early-abort based on our Slack discussion. here though the flip in logic matches the existing behavior, whereas a strict check for false would change it.
This is the last part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other. This patch separates the findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those data. This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code. Developed in #7507 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell. Fixes #61648. git-svn-id: https://develop.svn.wordpress.org/trunk@59176 602fd350-edb4-49c9-b593-d223f7449a82
This is the last part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other. This patch separates the findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those data. This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code. Developed in WordPress/wordpress-develop#7507 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell. Fixes #61648. Built from https://develop.svn.wordpress.org/trunk@59176 git-svn-id: http://core.svn.wordpress.org/trunk@58571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the last part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other. This patch separates the findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those data. This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code. Developed in WordPress/wordpress-develop#7507 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell. Fixes #61648. Built from https://develop.svn.wordpress.org/trunk@59176 git-svn-id: https://core.svn.wordpress.org/trunk@58571 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This is the last part in a larger modularization of the data in `WP_Debug_Data`. Previously this was a single massive method drawing in debug data from various groups of related data, where the groups were independent from each other. This patch separates the findal set of twelve groups, the `wp-active-theme`, `wp-parent-theme`, and `wp-themes-inactive` info, into a separate methods focused on those data. This work precedes changes to make the `WP_Debug_Data` class more extensible for better use by plugin and theme code. Developed in WordPress#7507 Discussed in https://core.trac.wordpress.org/ticket/61648 Props apermo, dmsnell. Fixes #61648. git-svn-id: https://develop.svn.wordpress.org/trunk@59176 602fd350-edb4-49c9-b593-d223f7449a82
'wp-active-theme' => self::get_wp_active_theme(),
'wp-parent-theme' => self::get_wp_parent_theme(),
'wp-themes-inactive' => self::get_wp_themes_inactive(),
Follow up to #7027 as discussed with @dmsnell and @costdev
Summary of the coming steps:
Refactoring WP_Debug_Data::debug_data(); into smaller functions for
Trac ticket: https://core.trac.wordpress.org/ticket/61648#ticket
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.