Media: Stop using and deprecate `set_imagick_time_limit()`. Seems it causes more problems than it solves.

Follow-up to #52569 and [55404].

Props: dsar, antpb, audrasjb, SergeyBiryukov, hberberoglu, mtxz, densityapps, ekazda, matt_fw, soulseekah, mikeschroder, azaozz.

Fixes: #58202.
Built from https://develop.svn.wordpress.org/trunk@56250


git-svn-id: http://core.svn.wordpress.org/trunk@55762 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2023-07-17 20:04:24 +00:00
parent 018821ff9a
commit 427f0159cc
2 changed files with 7 additions and 5 deletions

View File

@ -268,6 +268,9 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* This function, which is expected to be run before heavy image routines, resolves
* point 1 above by aligning Imagick's timeout with PHP's timeout, assuming it is set.
*
* However seems it introduces more problems than it fixes,
* see https://core.trac.wordpress.org/ticket/58202.
*
* Note:
* - Imagick resource exhaustion does not issue catchable exceptions (yet).
* See https://github.com/Imagick/imagick/issues/333.
@ -275,10 +278,13 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
* image operations within the time of the HTTP request.
*
* @since 6.2.0
* @since 6.3.0 This method was deprecated.
*
* @return int|null The new limit on success, null on failure.
*/
public static function set_imagick_time_limit() {
_deprecated_function( __METHOD__, '6.3.0' );
if ( ! defined( 'Imagick::RESOURCETYPE_TIME' ) ) {
return null;
}
@ -329,8 +335,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
return $this->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h );
}
self::set_imagick_time_limit();
// Execute the resize.
$thumb_result = $this->thumbnail_image( $dst_w, $dst_h );
if ( is_wp_error( $thumb_result ) ) {
@ -597,8 +601,6 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$src_h -= $src_y;
}
self::set_imagick_time_limit();
try {
$this->image->cropImage( $src_w, $src_h, $src_x, $src_y );
$this->image->setImagePage( $src_w, $src_h, 0, 0 );

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3-beta4-56249';
$wp_version = '6.3-beta4-56250';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.