-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expose disk size for installed plugins #10671
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
Open
maulikmakwana2008
wants to merge
1
commit into
WordPress:trunk
Choose a base branch
from
maulikmakwana2008:ticket-64445
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -63,9 +63,18 @@ | |
| <div id="health-check-debug" class="health-check-accordion"> | ||
|
|
||
| <?php | ||
|
|
||
| // Build sizes_fields array to include all plugin size fields dynamically. | ||
| $sizes_fields = array( 'uploads_size', 'themes_size', 'plugins_size', 'fonts_size', 'wordpress_size', 'database_size', 'total_size' ); | ||
|
|
||
| // Add individual plugin size fields if they exist in the info data. | ||
| if ( isset( $info['wp-paths-sizes'] ) && isset( $info['wp-paths-sizes']['fields'] ) ) { | ||
| foreach ( $info['wp-paths-sizes']['fields'] as $field_name => $field ) { | ||
| if ( strpos( $field_name, 'plugin_' ) === 0 && strpos( $field_name, '_size' ) !== false ) { | ||
| $sizes_fields[] = $field_name; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| foreach ( $info as $section => $details ) { | ||
| if ( ! isset( $details['fields'] ) || empty( $details['fields'] ) ) { | ||
| continue; | ||
|
|
@@ -113,6 +122,17 @@ | |
| <?php | ||
|
|
||
| foreach ( $details['fields'] as $field_name => $field ) { | ||
| // Check if this is the plugins individual header. | ||
| if ( isset( $field['is_plugins_header'] ) && $field['is_plugins_header'] ) { | ||
| // Format header with tree character. | ||
| $header_label = ' ├─ ' . esc_html( $field['label'] ); | ||
| printf( '<tr><th scope="row">%s</th><td></td></tr>', $header_label ); | ||
| continue; | ||
| } | ||
|
|
||
| // Check if this is an individual plugin field. | ||
| $is_plugin_individual = isset( $field['is_plugin_individual'] ) && $field['is_plugin_individual']; | ||
|
|
||
| if ( is_array( $field['value'] ) ) { | ||
| $values = '<ul>'; | ||
|
|
||
|
|
@@ -125,10 +145,24 @@ | |
| $values = esc_html( $field['value'] ); | ||
| } | ||
|
|
||
| // Format plugin individual fields: show plugin name with tree character in label, "plugin_name: size" in value. | ||
| if ( $is_plugin_individual ) { | ||
| // Label already has tree character and plugin name from class-wp-debug-data.php. | ||
| $label = esc_html( $field['label'] ); | ||
| // Format value as "plugin_name: size" if we have a size value. | ||
| if ( ! empty( $values ) && $values !== esc_html( __( 'Loading…' ) ) ) { | ||
| // Extract plugin name from label (remove tree characters and spaces). | ||
| $plugin_name = preg_replace( '/^\s*[├└]─\s*/', '', $field['label'] ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Humm. The tree characters are added and then later removed? It seems like it should be added only at the end when it is printed. |
||
| $values = esc_html( $plugin_name ) . ': ' . $values; | ||
| } | ||
| } else { | ||
| $label = esc_html( $field['label'] ); | ||
| } | ||
|
|
||
| if ( in_array( $field_name, $sizes_fields, true ) ) { | ||
| printf( '<tr><th scope="row">%s</th><td class="%s">%s</td></tr>', esc_html( $field['label'] ), esc_attr( $field_name ), $values ); | ||
| printf( '<tr><th scope="row">%s</th><td class="%s">%s</td></tr>', $label, esc_attr( $field_name ), $values ); | ||
| } else { | ||
| printf( '<tr><th scope="row">%s</th><td>%s</td></tr>', esc_html( $field['label'] ), $values ); | ||
| printf( '<tr><th scope="row">%s</th><td>%s</td></tr>', $label, $values ); | ||
| } | ||
| } | ||
|
|
||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not totally sold on this way of formatting the plugins.