From af4b043a693fc7178ef8a1fcd0402f14fba0a040 Mon Sep 17 00:00:00 2001 From: desrosj Date: Wed, 5 May 2021 19:21:59 +0000 Subject: [PATCH] Site Health: Include more ImageMagick/Imagick information in the Media Handling section. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds additional information to the Media Handling section of the Site Health Info page. When ImageMagick is used as the site’s image editor, a full list of file formats supported will now be shown. This will help site owners debug any issues they encounter as support for newer, more modern image formats is added (such as WebP in [50810]). Additionally, the version of Imagick installed. This will help site owners debug issues with generating images on the PHP side. Some variables have also been renamed to more accurately represent what is being stored. Props Clorith, desrosj. Fixes #53022. Built from https://develop.svn.wordpress.org/trunk@50817 git-svn-id: http://core.svn.wordpress.org/trunk@50426 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/class-wp-debug-data.php | 29 +++++++++++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/class-wp-debug-data.php b/wp-admin/includes/class-wp-debug-data.php index f68233dd61..85ef2384c9 100644 --- a/wp-admin/includes/class-wp-debug-data.php +++ b/wp-admin/includes/class-wp-debug-data.php @@ -515,20 +515,27 @@ class WP_Debug_Data { // 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' ) ) { @@ -597,6 +604,18 @@ class WP_Debug_Data { '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. diff --git a/wp-includes/version.php b/wp-includes/version.php index cdf60b5f99..8fbf6315da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.8-alpha-50816'; +$wp_version = '5.8-alpha-50817'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.