Plugin Directory

Changeset 3830643


Ignore:
Timestamp:
11/28/2026 12:05:26 AM (83 minutes ago)
Author:
wiwercy
Message:

Release 0.10.1 - WordPress 7.2 Compatibility Update

Location:
wiwercy-web-image-converter
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • wiwercy-web-image-converter/tags/0.10.1/readme.txt

    r3751258 r3830643  
    44Tags: avif, webp, image optimization, media library, performance
    55Requires at least: 6.5
    6 Tested up to: 7.1
     6Tested up to: 7.2
    77Requires PHP: 8.0
    8 Stable tag: 0.9.3
     8Stable tag: 0.10.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    7676This can be expected. The plugin may keep the original when the converted image family is not smaller, when a source format is disabled, or when a file is not part of a managed WordPress attachment family.
    7777
     78= How does Wiwercy work with WordPress 7.2? =
     79
     80Automatic conversion selects server-side processing. Disable it to allow native browser processing; reload existing editors after changing the setting. Finish uploads before bulk or CLI conversion.
     81
    7882= Does Media Library conversion regenerate all image sizes? =
    7983
    … …  
    118122== Changelog ==
    119123
     124= 0.10.1 =
     125* WordPress 7.2 compatibility update: automatic Wiwercy conversion uses the classic server-side upload pipeline on WordPress 7.1 and later.
     126* Preserve native browser processing when automatic conversion is disabled; protect REST media create, sideload and finalize operations from premature conversion and deletion.
     127* Preserve existing Safe Family Migration, Imagick/GD, WP-CLI and quality safeguards.
     128* Added REST compatibility regression coverage and WordPress 7.2 RC3 CI environments.
     129
    120130= 0.9.3 =
    121131* Bundled 14 interface translations for localized WordPress administration.
    … …  
    138148
    139149= 0.9.0 =
    140 * Prepared the plugin for WordPress.org distribution.
    141 * Removed the bundled external GitHub update checker from the distributed plugin.
    142 * Added GPLv2-or-later licensing metadata and a full LICENSE file.
    143 * Reworked readme.txt for the WordPress.org Plugin Directory.
    144 * Added privacy and FAQ documentation.
    145 * Added WordPress.org submission-package validation, official Plugin Check CI and a compatibility test matrix.
    146 * Kept the existing safe conversion, rollback, localization and storage-diagnostics features.
    147 * Verified real uploads, thumbnails, source-family migration and recovery in four WordPress/PHP environments.
    148 * Fixed GD conversion responses on PHP 8.5 and strengthened metadata and post-reference recovery.
    149 
     150* Prepared WordPress.org distribution, licensing, Plugin Check CI and compatibility testing.
     151* Preserved safe migration, rollback and storage diagnostics.
  • wiwercy-web-image-converter/tags/0.10.1/wiwercy-web-image-converter.php

    r3751258 r3830643  
    33 * Plugin Name: Wiwercy Web Image Converter
    44 * Description: Converts WordPress images to AVIF or WebP with safe Media Library migration and local conversion backends.
    5  * Version: 0.9.3
     5 * Version: 0.10.1
    66 * Author: Wiwercy
    77 * License: GPL v2 or later
    … …  
    2929
    3030if ( ! defined( 'WWIC_VERSION' ) ) {
    31     define( 'WWIC_VERSION', '0.9.3' );
     31    define( 'WWIC_VERSION', '0.10.1' );
    3232}
    3333
    … …  
    5959    private const V090_UPDATER_CLEANUP_OPTION = 'wwic_v090_updater_cleanup_done';
    6060
     61    // Request-scoped guard, including internal REST dispatches and nested requests.
     62    private static array $native_media_requests = [];
     63
    6164    public static function activate(): void {
    6265        self::maybe_migrate_v01_options();
    … …  
    7982        add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ self::class, 'plugin_action_links' ] );
    8083
     84        // WordPress 7.1+ can upload originals and derivatives in separate REST requests.
     85        // Preserve Wiwercy's server-side conversion contract when auto-conversion is enabled.
     86        add_filter( 'wp_client_side_media_processing_enabled', [ self::class, 'filter_client_media_processing' ], 100 );
     87        add_filter( 'rest_request_before_callbacks', [ self::class, 'before_media_rest_request' ], 10, 3 );
     88        add_filter( 'rest_request_after_callbacks', [ self::class, 'after_media_rest_request' ], 10, 3 );
    8189        add_filter( 'wp_handle_upload', [ self::class, 'convert_upload' ], 20, 2 );
    8290        add_filter( 'mime_types', [ self::class, 'allow_modern_mimes' ] );
    … …  
    27612769    }
    27622770
     2771    /**
     2772     * Keep core's native pipeline when automatic conversion is off.
     2773     * Never re-enable processing that core or another plugin already disabled.
     2774     */
     2775    public static function filter_client_media_processing( bool $enabled ): bool {
     2776        return $enabled && empty( self::settings()['enabled'] );
     2777    }
     2778
     2779    /**
     2780     * Protect native multi-request uploads and explicit REST format opt-outs,
     2781     * including stale editor sessions opened before the setting was changed.
     2782     * This does not modify authorization, request arguments, or core responses.
     2783     */
     2784    public static function before_media_rest_request( $response, array $handler, WP_REST_Request $request ) {
     2785        $route = untrailingslashit( $request->get_route() );
     2786        if ( 'POST' === $request->get_method() ) {
     2787            if (
     2788                preg_match( '#^/wp/v2/media/[0-9]+/(?:sideload|finalize)$#D', $route )
     2789                || ( '/wp/v2/media' === $route && (
     2790                    false === $request->get_param( 'generate_sub_sizes' )
     2791                    || false === $request->get_param( 'convert_format' )
     2792                ) )
     2793            ) {
     2794                self::$native_media_requests[ spl_object_id( $request ) ] = true;
     2795            }
     2796        }
     2797
     2798        return $response;
     2799    }
     2800
     2801    public static function after_media_rest_request( $response, array $handler, WP_REST_Request $request ) {
     2802        unset( self::$native_media_requests[ spl_object_id( $request ) ] );
     2803        return $response;
     2804    }
     2805
    27632806    public static function convert_upload( array $upload, string $context = 'upload' ): array {
     2807        // Do not rewrite file, MIME, URL or delete a core-managed original/sub-size.
     2808        if ( ! empty( self::$native_media_requests ) ) {
     2809            return $upload;
     2810        }
     2811
    27642812        if ( isset( $upload['error'] ) || empty( $upload['file'] ) || empty( $upload['type'] ) ) {
    27652813            return $upload;
  • wiwercy-web-image-converter/trunk/readme.txt

    r3751258 r3830643  
    44Tags: avif, webp, image optimization, media library, performance
    55Requires at least: 6.5
    6 Tested up to: 7.1
     6Tested up to: 7.2
    77Requires PHP: 8.0
    8 Stable tag: 0.9.3
     8Stable tag: 0.10.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    7676This can be expected. The plugin may keep the original when the converted image family is not smaller, when a source format is disabled, or when a file is not part of a managed WordPress attachment family.
    7777
     78= How does Wiwercy work with WordPress 7.2? =
     79
     80Automatic conversion selects server-side processing. Disable it to allow native browser processing; reload existing editors after changing the setting. Finish uploads before bulk or CLI conversion.
     81
    7882= Does Media Library conversion regenerate all image sizes? =
    7983
    … …  
    118122== Changelog ==
    119123
     124= 0.10.1 =
     125* WordPress 7.2 compatibility update: automatic Wiwercy conversion uses the classic server-side upload pipeline on WordPress 7.1 and later.
     126* Preserve native browser processing when automatic conversion is disabled; protect REST media create, sideload and finalize operations from premature conversion and deletion.
     127* Preserve existing Safe Family Migration, Imagick/GD, WP-CLI and quality safeguards.
     128* Added REST compatibility regression coverage and WordPress 7.2 RC3 CI environments.
     129
    120130= 0.9.3 =
    121131* Bundled 14 interface translations for localized WordPress administration.
    … …  
    138148
    139149= 0.9.0 =
    140 * Prepared the plugin for WordPress.org distribution.
    141 * Removed the bundled external GitHub update checker from the distributed plugin.
    142 * Added GPLv2-or-later licensing metadata and a full LICENSE file.
    143 * Reworked readme.txt for the WordPress.org Plugin Directory.
    144 * Added privacy and FAQ documentation.
    145 * Added WordPress.org submission-package validation, official Plugin Check CI and a compatibility test matrix.
    146 * Kept the existing safe conversion, rollback, localization and storage-diagnostics features.
    147 * Verified real uploads, thumbnails, source-family migration and recovery in four WordPress/PHP environments.
    148 * Fixed GD conversion responses on PHP 8.5 and strengthened metadata and post-reference recovery.
    149 
     150* Prepared WordPress.org distribution, licensing, Plugin Check CI and compatibility testing.
     151* Preserved safe migration, rollback and storage diagnostics.
  • wiwercy-web-image-converter/trunk/wiwercy-web-image-converter.php

    r3751258 r3830643  
    33 * Plugin Name: Wiwercy Web Image Converter
    44 * Description: Converts WordPress images to AVIF or WebP with safe Media Library migration and local conversion backends.
    5  * Version: 0.9.3
     5 * Version: 0.10.1
    66 * Author: Wiwercy
    77 * License: GPL v2 or later
    … …  
    2929
    3030if ( ! defined( 'WWIC_VERSION' ) ) {
    31     define( 'WWIC_VERSION', '0.9.3' );
     31    define( 'WWIC_VERSION', '0.10.1' );
    3232}
    3333
    … …  
    5959    private const V090_UPDATER_CLEANUP_OPTION = 'wwic_v090_updater_cleanup_done';
    6060
     61    // Request-scoped guard, including internal REST dispatches and nested requests.
     62    private static array $native_media_requests = [];
     63
    6164    public static function activate(): void {
    6265        self::maybe_migrate_v01_options();
    … …  
    7982        add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ self::class, 'plugin_action_links' ] );
    8083
     84        // WordPress 7.1+ can upload originals and derivatives in separate REST requests.
     85        // Preserve Wiwercy's server-side conversion contract when auto-conversion is enabled.
     86        add_filter( 'wp_client_side_media_processing_enabled', [ self::class, 'filter_client_media_processing' ], 100 );
     87        add_filter( 'rest_request_before_callbacks', [ self::class, 'before_media_rest_request' ], 10, 3 );
     88        add_filter( 'rest_request_after_callbacks', [ self::class, 'after_media_rest_request' ], 10, 3 );
    8189        add_filter( 'wp_handle_upload', [ self::class, 'convert_upload' ], 20, 2 );
    8290        add_filter( 'mime_types', [ self::class, 'allow_modern_mimes' ] );
    … …  
    27612769    }
    27622770
     2771    /**
     2772     * Keep core's native pipeline when automatic conversion is off.
     2773     * Never re-enable processing that core or another plugin already disabled.
     2774     */
     2775    public static function filter_client_media_processing( bool $enabled ): bool {
     2776        return $enabled && empty( self::settings()['enabled'] );
     2777    }
     2778
     2779    /**
     2780     * Protect native multi-request uploads and explicit REST format opt-outs,
     2781     * including stale editor sessions opened before the setting was changed.
     2782     * This does not modify authorization, request arguments, or core responses.
     2783     */
     2784    public static function before_media_rest_request( $response, array $handler, WP_REST_Request $request ) {
     2785        $route = untrailingslashit( $request->get_route() );
     2786        if ( 'POST' === $request->get_method() ) {
     2787            if (
     2788                preg_match( '#^/wp/v2/media/[0-9]+/(?:sideload|finalize)$#D', $route )
     2789                || ( '/wp/v2/media' === $route && (
     2790                    false === $request->get_param( 'generate_sub_sizes' )
     2791                    || false === $request->get_param( 'convert_format' )
     2792                ) )
     2793            ) {
     2794                self::$native_media_requests[ spl_object_id( $request ) ] = true;
     2795            }
     2796        }
     2797
     2798        return $response;
     2799    }
     2800
     2801    public static function after_media_rest_request( $response, array $handler, WP_REST_Request $request ) {
     2802        unset( self::$native_media_requests[ spl_object_id( $request ) ] );
     2803        return $response;
     2804    }
     2805
    27632806    public static function convert_upload( array $upload, string $context = 'upload' ): array {
     2807        // Do not rewrite file, MIME, URL or delete a core-managed original/sub-size.
     2808        if ( ! empty( self::$native_media_requests ) ) {
     2809            return $upload;
     2810        }
     2811
    27642812        if ( isset( $upload['error'] ) || empty( $upload['file'] ) || empty( $upload['type'] ) ) {
    27652813            return $upload;
Note: See TracChangeset for help on using the changeset viewer.