WordPress.org

Make WordPress Core

Changeset 50817


Ignore:
Timestamp:
05/05/2021 07:20:55 PM (5 months ago)
Author:
desrosj
Message:

Site Health: Include more ImageMagick/Imagick information in the Media Handling section.

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-debug-data.php

    r49908 r50817  
    516516        if ( class_exists( 'Imagick' ) ) {
    517517            // Save the Imagick instance for later use.
    518             $imagick         = new Imagick();
    519             $imagick_version = $imagick->getVersion();
    520         } else {
    521             $imagick_version = __( 'Not available' );
     518            $imagick             = new Imagick();
     519            $imagemagick_version = $imagick->getVersion();
     520        } else {
     521            $imagemagick_version = __( 'Not available' );
    522522        }
    523523
    524524        $info['wp-media']['fields']['imagick_module_version'] = array(
    525525            'label' => __( 'ImageMagick version number' ),
    526             'value' => ( is_array( $imagick_version ) ? $imagick_version['versionNumber'] : $imagick_version ),
     526            'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionNumber'] : $imagemagick_version ),
    527527        );
    528528
    529529        $info['wp-media']['fields']['imagemagick_version'] = array(
    530530            'label' => __( 'ImageMagick version string' ),
    531             'value' => ( is_array( $imagick_version ) ? $imagick_version['versionString'] : $imagick_version ),
     531            'value' => ( is_array( $imagemagick_version ) ? $imagemagick_version['versionString'] : $imagemagick_version ),
     532        );
     533
     534        $imagick_version = phpversion( 'imagick' );
     535
     536        $info['wp-media']['fields']['imagick_version'] = array(
     537            'label' => __( 'Imagick version' ),
     538            'value' => ( $imagick_version ) ? $imagick_version : __( 'Not available' ),
    532539        );
    533540
     
    597604                'value' => $limits,
    598605                'debug' => $limits_debug,
     606            );
     607
     608            try {
     609                $formats = Imagick::queryFormats( '*' );
     610            } catch ( Exception $e ) {
     611                $formats = array();
     612            }
     613
     614            $info['wp-media']['fields']['imagemagick_file_formats'] = array(
     615                'label' => __( 'ImageMagick supported file formats' ),
     616                'value' => ( empty( $formats ) ) ? __( 'Unable to determine' ) : implode( ', ', $formats ),
     617                'debug' => ( empty( $formats ) ) ? 'Unable to determine' : implode( ', ', $formats ),
    599618            );
    600619        }
Note: See TracChangeset for help on using the changeset viewer.