diff -r 34716fd837a4 -r be944660c56a wp/wp-admin/includes/class-wp-debug-data.php --- a/wp/wp-admin/includes/class-wp-debug-data.php Tue Dec 15 15:52:01 2020 +0100 +++ b/wp/wp-admin/includes/class-wp-debug-data.php Wed Sep 21 18:19:35 2022 +0200 @@ -48,12 +48,14 @@ $core_updates = get_core_updates(); $core_update_needed = ''; - foreach ( $core_updates as $core => $update ) { - if ( 'upgrade' === $update->response ) { - /* translators: %s: Latest WordPress version number. */ - $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version ); - } else { - $core_update_needed = ''; + if ( is_array( $core_updates ) ) { + foreach ( $core_updates as $core => $update ) { + if ( 'upgrade' === $update->response ) { + /* translators: %s: Latest WordPress version number. */ + $core_update_needed = ' ' . sprintf( __( '(Latest version: %s)' ), $update->version ); + } else { + $core_update_needed = ''; + } } } @@ -268,6 +270,10 @@ 'label' => 'WP_PLUGIN_DIR', 'value' => WP_PLUGIN_DIR, ), + 'WP_MEMORY_LIMIT' => array( + 'label' => 'WP_MEMORY_LIMIT', + 'value' => WP_MEMORY_LIMIT, + ), 'WP_MAX_MEMORY_LIMIT' => array( 'label' => 'WP_MAX_MEMORY_LIMIT', 'value' => WP_MAX_MEMORY_LIMIT, @@ -509,20 +515,27 @@ // Get ImageMagic information, if available. if ( class_exists( 'Imagick' ) ) { // Save the Imagick instance for later use. - $imagick = new Imagick(); - $imagick_version = $imagick->getVersion(); + $imagick = new Imagick(); + $imagemagick_version = $imagick->getVersion(); } else { - $imagick_version = __( 'Not available' ); + $imagemagick_version = __( 'Not available' ); } $info['wp-media']['fields']['imagick_module_version'] = array( 'label' => __( 'ImageMagick version number' ), - 'value' => ( is_array( $imagick_version ) ? $imagick_version['versionNumber'] : $imagick_version ), + 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ), ); $info['wp-media']['fields']['imagemagick_version'] = array( 'label' => __( 'ImageMagick version string' ), - 'value' => ( is_array( $imagick_version ) ? $imagick_version['versionString'] : $imagick_version ), + 'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ), + ); + + $imagick_version = phpversion( 'imagick' ); + + $info['wp-media']['fields']['imagick_version'] = array( + 'label' => __( 'Imagick version' ), + 'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ), ); if ( ! function_exists( 'ini_get' ) ) { @@ -591,6 +604,18 @@ 'value' => $limits, 'debug' => $limits_debug, ); + + try { + $formats = Imagick::queryFormats( '*' ); + } catch ( Exception $e ) { + $formats = array(); + } + + $info['wp-media']['fields']['imagemagick_file_formats'] = array( + 'label' => __( 'ImageMagick supported file formats' ), + 'value' => ( empty( $formats ) ) ? __( 'Unable to determine' ) : implode( ', ', $formats ), + 'debug' => ( empty( $formats ) ) ? 'Unable to determine' : implode( ', ', $formats ), + ); } // Get GD information, if available. @@ -606,6 +631,33 @@ 'debug' => ( is_array( $gd ) ? $gd['GD Version'] : 'not available' ), ); + $gd_image_formats = array(); + $gd_supported_formats = array( + 'GIF Create' => 'GIF', + 'JPEG' => 'JPEG', + 'PNG' => 'PNG', + 'WebP' => 'WebP', + 'BMP' => 'BMP', + 'AVIF' => 'AVIF', + 'HEIF' => 'HEIF', + 'TIFF' => 'TIFF', + 'XPM' => 'XPM', + ); + + foreach ( $gd_supported_formats as $format_key => $format ) { + $index = $format_key . ' Support'; + if ( isset( $gd[ $index ] ) && $gd[ $index ] ) { + array_push( $gd_image_formats, $format ); + } + } + + if ( ! empty( $gd_image_formats ) ) { + $info['wp-media']['fields']['gd_formats'] = array( + 'label' => __( 'GD supported file formats' ), + 'value' => implode( ', ', $gd_image_formats ), + ); + } + // Get Ghostscript information, if available. if ( function_exists( 'exec' ) ) { $gs = exec( 'gs --version' ); @@ -974,12 +1026,10 @@ 'requires_php' => '', 'compatibility' => new stdClass(), ); - $item = array_merge( $item, array_intersect_key( $plugin, $item ) ); + $item = wp_parse_args( $plugin, $item ); } - $type = 'plugin'; - /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); + $auto_update_forced = wp_is_auto_update_forced_for_item( 'plugin', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1121,9 +1171,7 @@ ); } - $type = 'theme'; - /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); + $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1209,9 +1257,7 @@ ); } - $type = 'theme'; - /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); + $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1299,9 +1345,7 @@ ); } - $type = 'theme'; - /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ - $auto_update_forced = apply_filters( "auto_update_{$type}", null, (object) $item ); + $auto_update_forced = wp_is_auto_update_forced_for_item( 'theme', null, (object) $item ); if ( ! is_null( $auto_update_forced ) ) { $enabled = $auto_update_forced; @@ -1327,7 +1371,7 @@ $auto_updates_string = apply_filters( 'theme_auto_update_debug_string', $auto_updates_string, $theme, $enabled ); $theme_version_string .= ' | ' . $auto_updates_string; - $theme_version_string_debug .= ',' . $auto_updates_string; + $theme_version_string_debug .= ', ' . $auto_updates_string; } $info['wp-themes-inactive']['fields'][ sanitize_text_field( $theme->name ) ] = array(