Changeset 3830643
- Timestamp:
- 11/28/2026 12:05:26 AM (83 minutes ago)
- Location:
- wiwercy-web-image-converter
- Files:
-
- 4 edited
- 1 copied
-
tags/0.10.1 (copied) (copied from wiwercy-web-image-converter/trunk )
-
tags/0.10.1/readme.txt (modified) (4 diffs)
-
tags/0.10.1/wiwercy-web-image-converter.php (modified) (5 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/wiwercy-web-image-converter.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiwercy-web-image-converter/tags/0.10.1/readme.txt
r3751258 r3830643 4 4 Tags: avif, webp, image optimization, media library, performance 5 5 Requires at least: 6.5 6 Tested up to: 7. 16 Tested up to: 7.2 7 7 Requires PHP: 8.0 8 Stable tag: 0. 9.38 Stable tag: 0.10.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 76 76 This 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. 77 77 78 = How does Wiwercy work with WordPress 7.2? = 79 80 Automatic 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 78 82 = Does Media Library conversion regenerate all image sizes? = 79 83 … … 118 122 == Changelog == 119 123 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 120 130 = 0.9.3 = 121 131 * Bundled 14 interface translations for localized WordPress administration. … … 138 148 139 149 = 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 3 3 * Plugin Name: Wiwercy Web Image Converter 4 4 * Description: Converts WordPress images to AVIF or WebP with safe Media Library migration and local conversion backends. 5 * Version: 0. 9.35 * Version: 0.10.1 6 6 * Author: Wiwercy 7 7 * License: GPL v2 or later … … 29 29 30 30 if ( ! defined( 'WWIC_VERSION' ) ) { 31 define( 'WWIC_VERSION', '0. 9.3' );31 define( 'WWIC_VERSION', '0.10.1' ); 32 32 } 33 33 … … 59 59 private const V090_UPDATER_CLEANUP_OPTION = 'wwic_v090_updater_cleanup_done'; 60 60 61 // Request-scoped guard, including internal REST dispatches and nested requests. 62 private static array $native_media_requests = []; 63 61 64 public static function activate(): void { 62 65 self::maybe_migrate_v01_options(); … … 79 82 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ self::class, 'plugin_action_links' ] ); 80 83 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 ); 81 89 add_filter( 'wp_handle_upload', [ self::class, 'convert_upload' ], 20, 2 ); 82 90 add_filter( 'mime_types', [ self::class, 'allow_modern_mimes' ] ); … … 2761 2769 } 2762 2770 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 2763 2806 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 2764 2812 if ( isset( $upload['error'] ) || empty( $upload['file'] ) || empty( $upload['type'] ) ) { 2765 2813 return $upload; -
wiwercy-web-image-converter/trunk/readme.txt
r3751258 r3830643 4 4 Tags: avif, webp, image optimization, media library, performance 5 5 Requires at least: 6.5 6 Tested up to: 7. 16 Tested up to: 7.2 7 7 Requires PHP: 8.0 8 Stable tag: 0. 9.38 Stable tag: 0.10.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 76 76 This 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. 77 77 78 = How does Wiwercy work with WordPress 7.2? = 79 80 Automatic 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 78 82 = Does Media Library conversion regenerate all image sizes? = 79 83 … … 118 122 == Changelog == 119 123 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 120 130 = 0.9.3 = 121 131 * Bundled 14 interface translations for localized WordPress administration. … … 138 148 139 149 = 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 3 3 * Plugin Name: Wiwercy Web Image Converter 4 4 * Description: Converts WordPress images to AVIF or WebP with safe Media Library migration and local conversion backends. 5 * Version: 0. 9.35 * Version: 0.10.1 6 6 * Author: Wiwercy 7 7 * License: GPL v2 or later … … 29 29 30 30 if ( ! defined( 'WWIC_VERSION' ) ) { 31 define( 'WWIC_VERSION', '0. 9.3' );31 define( 'WWIC_VERSION', '0.10.1' ); 32 32 } 33 33 … … 59 59 private const V090_UPDATER_CLEANUP_OPTION = 'wwic_v090_updater_cleanup_done'; 60 60 61 // Request-scoped guard, including internal REST dispatches and nested requests. 62 private static array $native_media_requests = []; 63 61 64 public static function activate(): void { 62 65 self::maybe_migrate_v01_options(); … … 79 82 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), [ self::class, 'plugin_action_links' ] ); 80 83 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 ); 81 89 add_filter( 'wp_handle_upload', [ self::class, 'convert_upload' ], 20, 2 ); 82 90 add_filter( 'mime_types', [ self::class, 'allow_modern_mimes' ] ); … … 2761 2769 } 2762 2770 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 2763 2806 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 2764 2812 if ( isset( $upload['error'] ) || empty( $upload['file'] ) || empty( $upload['type'] ) ) { 2765 2813 return $upload;
Note:
See TracChangeset
for help on using the changeset viewer.