diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index 109e38b063..49214ff8ec 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -342,50 +342,6 @@ class WP_Debug_Data { ), ); - $is_writable_abspath = wp_is_writable( ABSPATH ); - $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); - $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); - $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); - $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); - $is_writable_fonts_dir = wp_is_writable( wp_get_font_dir()['basedir'] ); - - $info['wp-filesystem'] = array( - 'label' => __( 'Filesystem Permissions' ), - 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ), - 'fields' => array( - 'wordpress' => array( - 'label' => __( 'The main WordPress directory' ), - 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ), - ), - 'wp-content' => array( - 'label' => __( 'The wp-content directory' ), - 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ), - ), - 'uploads' => array( - 'label' => __( 'The uploads directory' ), - 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ), - ), - 'plugins' => array( - 'label' => __( 'The plugins directory' ), - 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ), - ), - 'themes' => array( - 'label' => __( 'The themes directory' ), - 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ), - ), - 'fonts' => array( - 'label' => __( 'The fonts directory' ), - 'value' => ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_fonts_dir ? 'writable' : 'not writable' ), - ), - ), - ); - // Conditionally add debug information for multisite setups. if ( is_multisite() ) { $site_id = get_current_blog_id(); @@ -1413,16 +1369,7 @@ class WP_Debug_Data { ); } - // Add more filesystem checks. - if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { - $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); - - $info['wp-filesystem']['fields']['mu-plugins'] = array( - 'label' => __( 'The must use plugins directory' ), - 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), - 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ), - ); - } + $info['wp-filesystem'] = self::get_wp_filesystem(); /** * Filters the debug information shown on the Tools -> Site Health -> Info screen. @@ -1489,6 +1436,73 @@ class WP_Debug_Data { return $info; } + /** + * Gets the file system section of the debug data. + * + * @since 6.7.0 + * + * @return array + */ + private static function get_wp_filesystem(): array { + $upload_dir = wp_upload_dir(); + $is_writable_abspath = wp_is_writable( ABSPATH ); + $is_writable_wp_content_dir = wp_is_writable( WP_CONTENT_DIR ); + $is_writable_upload_dir = wp_is_writable( $upload_dir['basedir'] ); + $is_writable_wp_plugin_dir = wp_is_writable( WP_PLUGIN_DIR ); + $is_writable_template_directory = wp_is_writable( get_theme_root( get_template() ) ); + $is_writable_fonts_dir = wp_is_writable( wp_get_font_dir()['basedir'] ); + + $fields = array( + 'wordpress' => array( + 'label' => __( 'The main WordPress directory' ), + 'value' => ( $is_writable_abspath ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_abspath ? 'writable' : 'not writable' ), + ), + 'wp-content' => array( + 'label' => __( 'The wp-content directory' ), + 'value' => ( $is_writable_wp_content_dir ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_wp_content_dir ? 'writable' : 'not writable' ), + ), + 'uploads' => array( + 'label' => __( 'The uploads directory' ), + 'value' => ( $is_writable_upload_dir ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_upload_dir ? 'writable' : 'not writable' ), + ), + 'plugins' => array( + 'label' => __( 'The plugins directory' ), + 'value' => ( $is_writable_wp_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_wp_plugin_dir ? 'writable' : 'not writable' ), + ), + 'themes' => array( + 'label' => __( 'The themes directory' ), + 'value' => ( $is_writable_template_directory ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_template_directory ? 'writable' : 'not writable' ), + ), + 'fonts' => array( + 'label' => __( 'The fonts directory' ), + 'value' => ( $is_writable_fonts_dir ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_fonts_dir ? 'writable' : 'not writable' ), + ), + ); + + // Add more filesystem checks. + if ( defined( 'WPMU_PLUGIN_DIR' ) && is_dir( WPMU_PLUGIN_DIR ) ) { + $is_writable_wpmu_plugin_dir = wp_is_writable( WPMU_PLUGIN_DIR ); + + $fields['mu-plugins'] = array( + 'label' => __( 'The must use plugins directory' ), + 'value' => ( $is_writable_wpmu_plugin_dir ? __( 'Writable' ) : __( 'Not writable' ) ), + 'debug' => ( $is_writable_wpmu_plugin_dir ? 'writable' : 'not writable' ), + ); + } + + return array( + 'label' => __( 'Filesystem Permissions' ), + 'description' => __( 'Shows whether WordPress is able to write to the directories it needs access to.' ), + 'fields' => $fields, + ); + } + /** * Returns the value of a MySQL system variable. * diff --git a/wp-includes/version.php b/wp-includes/version.php index 465cf685ef..460062b372 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.7-alpha-58829'; +$wp_version = '6.7-alpha-58830'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.