Changeset 3463651
- Timestamp:
- 02/17/2026 03:52:41 PM (6 weeks ago)
- Location:
- force-regenerate-thumbnails
- Files:
-
- 2 added
- 8 edited
- 1 copied
-
tags/2.3.0 (copied) (copied from force-regenerate-thumbnails/trunk)
-
tags/2.3.0/changelog.txt (modified) (1 diff)
-
tags/2.3.0/class-force-regenerate-thumbnails-cli.php (added)
-
tags/2.3.0/class-forceregeneratethumbnails.php (modified) (9 diffs)
-
tags/2.3.0/force-regenerate-thumbnails.php (modified) (2 diffs)
-
tags/2.3.0/readme.txt (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/class-force-regenerate-thumbnails-cli.php (added)
-
trunk/class-forceregeneratethumbnails.php (modified) (9 diffs)
-
trunk/force-regenerate-thumbnails.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
force-regenerate-thumbnails/tags/2.3.0/changelog.txt
r3305989 r3463651 1 = 2.3.0 = 2 *Release Date - February 17, 2026* 3 4 * added: WP_CLI command: force-regenerate-thumbnails props @realmranshuman 5 * fixed: PHP 8.5 compatibility 6 1 7 = 2.2.2 = 2 8 *Release Date - June 3, 2025* -
force-regenerate-thumbnails/tags/2.3.0/class-forceregeneratethumbnails.php
r3305989 r3463651 151 151 array_walk( $images, 'intval' ); 152 152 } 153 $ids = implode( ',', $images );154 153 delete_option( 'frt_last_regenerated' ); 155 154 } else { 156 157 155 $resume_position = get_option( 'frt_last_regenerated' ); 158 156 if ( empty( $resume_position ) ) { … … 184 182 return; 185 183 } 186 187 $ids = implode( ',', $images );188 184 } 189 185 … … 285 281 array( 286 282 'page' => 'force-regenerate-thumbnails', 287 'goback' => add_query_arg( null, null),283 'goback' => add_query_arg( '', '' ), 288 284 'ids' => (int) $post->ID, 289 285 ), … … 620 616 $image = get_post( $id ); 621 617 622 if ( is_null( $image ) ) { 623 /* translators: %d: attachment ID number */ 624 throw new Exception( sprintf( esc_html__( 'Failed: %d is an invalid media ID.', 'force-regenerate-thumbnails' ), (int) $id ) ); 625 } 626 627 if ( 'attachment' !== $image->post_type || ( 'image/' !== substr( $image->post_mime_type, 0, 6 ) && 'application/pdf' !== $image->post_mime_type ) ) { 618 if ( is_null( $image ) || 'attachment' !== $image->post_type || ( ! str_starts_with( $image->post_mime_type, 'image/' ) && 'application/pdf' !== $image->post_mime_type ) ) { 628 619 /* translators: %d: attachment ID number */ 629 620 throw new Exception( sprintf( esc_html__( 'Failed: %d is an invalid media ID.', 'force-regenerate-thumbnails' ), (int) $id ) ); … … 698 689 } 699 690 700 // Hack to find thumbnail.691 // Workaround to find thumbnails not in metadata. 701 692 $file_stem = $this->remove_from_end( $file_info['filename'], '-scaled' ) . '-'; 702 693 … … 707 698 $thumb = readdir( $path ); 708 699 while ( false !== $thumb ) { 709 if ( 0 === strpos( $thumb, $file_stem ) && str_ends_with( $thumb, $file_info['extension'] ) ) {700 if ( str_starts_with( $thumb, $file_stem ) && str_ends_with( $thumb, $file_info['extension'] ) ) { 710 701 $files[] = $thumb; 711 702 } … … 724 715 $thumb_info = pathinfo( $thumb_fullpath ); 725 716 $valid_thumb = explode( $file_stem, $thumb_info['filename'] ); 717 // This ensures we only target files that start with the original filename, but are also longer than the original. 718 // Otherwise, we might delete the original image, since the while() does not preclude the original. 726 719 if ( '' === $valid_thumb[0] && ! empty( $valid_thumb[1] ) ) { 720 // Further, if the thumbnail name appendage has 'scaled-' in it, we need to remove it for the dimension check coming up. 727 721 if ( 0 === strpos( $valid_thumb[1], 'scaled-' ) ) { 728 722 $valid_thumb[1] = str_replace( 'scaled-', '', $valid_thumb[1] ); … … 730 724 $dimension_thumb = explode( 'x', $valid_thumb[1] ); 731 725 if ( 2 === count( $dimension_thumb ) ) { 726 // Thus we only remove files with an appendage like '-150x150' or '-150x150-scaled'. 732 727 if ( is_numeric( $dimension_thumb[0] ) && is_numeric( $dimension_thumb[1] ) ) { 733 728 do_action( 'regenerate_thumbs_pre_delete', $thumb_fullpath ); … … 847 842 '</strong>'; 848 843 $message .= '<br><br>'; 849 // The Upload dir/URL are suppressed, just extra noise that we don't need.850 /* translators: %s: the path to the uploads directory */851 $old_message = '<code>' . sprintf( esc_html__( 'Upload Directory: %s', 'force-regenerate-thumbnails' ), esc_html( $upload_dir['basedir'] ) ) . '</code><br>';852 /* translators: %s: the base URL of the uploads directory */853 $old_message = '<code>' . sprintf( esc_html__( 'Upload URL: %s', 'force-regenerate-thumbnails' ), esc_html( $upload_dir['baseurl'] ) ) . '</code><br>';854 844 /* translators: %s: the full path of the image */ 855 845 $message .= '<code>' . sprintf( esc_html__( 'Image: %s', 'force-regenerate-thumbnails' ), esc_html( $debug_1 ) ) . '</code><br>'; -
force-regenerate-thumbnails/tags/2.3.0/force-regenerate-thumbnails.php
r3305989 r3463651 11 11 Plugin URI: https://wordpress.org/plugins/force-regenerate-thumbnails/ 12 12 Description: Delete and REALLY force the regeneration of thumbnails. 13 Version: 2. 2.214 Requires at least: 6. 513 Version: 2.3.0 14 Requires at least: 6.6 15 15 Requires PHP: 7.4 16 16 Author: Exactly WWW … … 77 77 } 78 78 add_action( 'init', 'force_regenerate_thumbnails' ); 79 80 // Register WP-CLI command if WP_CLI is present. 81 if ( defined( 'WP_CLI' ) && WP_CLI ) { 82 require_once trailingslashit( __DIR__ ) . 'class-force-regenerate-thumbnails-cli.php'; 83 } -
force-regenerate-thumbnails/tags/2.3.0/readme.txt
r3305989 r3463651 1 1 === Force Regenerate Thumbnails === 2 2 Contributors: pedro-elsner, nosilver4u 3 Requires at least: 6. 54 Tested up to: 6. 83 Requires at least: 6.6 4 Tested up to: 6.9 5 5 Requires PHP: 7.4 6 Stable tag: 2. 2.26 Stable tag: 2.3.0 7 7 License: GPLv2 8 8 Tags: force, regenerate thumbnails, thumbnail, thumbnails … … 34 34 35 35 == ChangeLog == 36 37 = 2.3.0 = 38 *Release Date - February 17, 2026* 39 40 * added: WP_CLI command: force-regenerate-thumbnails props @realmranshuman 41 * fixed: PHP 8.5 compatibility 36 42 37 43 = 2.2.2 = -
force-regenerate-thumbnails/trunk/changelog.txt
r3305989 r3463651 1 = 2.3.0 = 2 *Release Date - February 17, 2026* 3 4 * added: WP_CLI command: force-regenerate-thumbnails props @realmranshuman 5 * fixed: PHP 8.5 compatibility 6 1 7 = 2.2.2 = 2 8 *Release Date - June 3, 2025* -
force-regenerate-thumbnails/trunk/class-forceregeneratethumbnails.php
r3305989 r3463651 151 151 array_walk( $images, 'intval' ); 152 152 } 153 $ids = implode( ',', $images );154 153 delete_option( 'frt_last_regenerated' ); 155 154 } else { 156 157 155 $resume_position = get_option( 'frt_last_regenerated' ); 158 156 if ( empty( $resume_position ) ) { … … 184 182 return; 185 183 } 186 187 $ids = implode( ',', $images );188 184 } 189 185 … … 285 281 array( 286 282 'page' => 'force-regenerate-thumbnails', 287 'goback' => add_query_arg( null, null),283 'goback' => add_query_arg( '', '' ), 288 284 'ids' => (int) $post->ID, 289 285 ), … … 620 616 $image = get_post( $id ); 621 617 622 if ( is_null( $image ) ) { 623 /* translators: %d: attachment ID number */ 624 throw new Exception( sprintf( esc_html__( 'Failed: %d is an invalid media ID.', 'force-regenerate-thumbnails' ), (int) $id ) ); 625 } 626 627 if ( 'attachment' !== $image->post_type || ( 'image/' !== substr( $image->post_mime_type, 0, 6 ) && 'application/pdf' !== $image->post_mime_type ) ) { 618 if ( is_null( $image ) || 'attachment' !== $image->post_type || ( ! str_starts_with( $image->post_mime_type, 'image/' ) && 'application/pdf' !== $image->post_mime_type ) ) { 628 619 /* translators: %d: attachment ID number */ 629 620 throw new Exception( sprintf( esc_html__( 'Failed: %d is an invalid media ID.', 'force-regenerate-thumbnails' ), (int) $id ) ); … … 698 689 } 699 690 700 // Hack to find thumbnail.691 // Workaround to find thumbnails not in metadata. 701 692 $file_stem = $this->remove_from_end( $file_info['filename'], '-scaled' ) . '-'; 702 693 … … 707 698 $thumb = readdir( $path ); 708 699 while ( false !== $thumb ) { 709 if ( 0 === strpos( $thumb, $file_stem ) && str_ends_with( $thumb, $file_info['extension'] ) ) {700 if ( str_starts_with( $thumb, $file_stem ) && str_ends_with( $thumb, $file_info['extension'] ) ) { 710 701 $files[] = $thumb; 711 702 } … … 724 715 $thumb_info = pathinfo( $thumb_fullpath ); 725 716 $valid_thumb = explode( $file_stem, $thumb_info['filename'] ); 717 // This ensures we only target files that start with the original filename, but are also longer than the original. 718 // Otherwise, we might delete the original image, since the while() does not preclude the original. 726 719 if ( '' === $valid_thumb[0] && ! empty( $valid_thumb[1] ) ) { 720 // Further, if the thumbnail name appendage has 'scaled-' in it, we need to remove it for the dimension check coming up. 727 721 if ( 0 === strpos( $valid_thumb[1], 'scaled-' ) ) { 728 722 $valid_thumb[1] = str_replace( 'scaled-', '', $valid_thumb[1] ); … … 730 724 $dimension_thumb = explode( 'x', $valid_thumb[1] ); 731 725 if ( 2 === count( $dimension_thumb ) ) { 726 // Thus we only remove files with an appendage like '-150x150' or '-150x150-scaled'. 732 727 if ( is_numeric( $dimension_thumb[0] ) && is_numeric( $dimension_thumb[1] ) ) { 733 728 do_action( 'regenerate_thumbs_pre_delete', $thumb_fullpath ); … … 847 842 '</strong>'; 848 843 $message .= '<br><br>'; 849 // The Upload dir/URL are suppressed, just extra noise that we don't need.850 /* translators: %s: the path to the uploads directory */851 $old_message = '<code>' . sprintf( esc_html__( 'Upload Directory: %s', 'force-regenerate-thumbnails' ), esc_html( $upload_dir['basedir'] ) ) . '</code><br>';852 /* translators: %s: the base URL of the uploads directory */853 $old_message = '<code>' . sprintf( esc_html__( 'Upload URL: %s', 'force-regenerate-thumbnails' ), esc_html( $upload_dir['baseurl'] ) ) . '</code><br>';854 844 /* translators: %s: the full path of the image */ 855 845 $message .= '<code>' . sprintf( esc_html__( 'Image: %s', 'force-regenerate-thumbnails' ), esc_html( $debug_1 ) ) . '</code><br>'; -
force-regenerate-thumbnails/trunk/force-regenerate-thumbnails.php
r3305989 r3463651 11 11 Plugin URI: https://wordpress.org/plugins/force-regenerate-thumbnails/ 12 12 Description: Delete and REALLY force the regeneration of thumbnails. 13 Version: 2. 2.214 Requires at least: 6. 513 Version: 2.3.0 14 Requires at least: 6.6 15 15 Requires PHP: 7.4 16 16 Author: Exactly WWW … … 77 77 } 78 78 add_action( 'init', 'force_regenerate_thumbnails' ); 79 80 // Register WP-CLI command if WP_CLI is present. 81 if ( defined( 'WP_CLI' ) && WP_CLI ) { 82 require_once trailingslashit( __DIR__ ) . 'class-force-regenerate-thumbnails-cli.php'; 83 } -
force-regenerate-thumbnails/trunk/readme.txt
r3305989 r3463651 1 1 === Force Regenerate Thumbnails === 2 2 Contributors: pedro-elsner, nosilver4u 3 Requires at least: 6. 54 Tested up to: 6. 83 Requires at least: 6.6 4 Tested up to: 6.9 5 5 Requires PHP: 7.4 6 Stable tag: 2. 2.26 Stable tag: 2.3.0 7 7 License: GPLv2 8 8 Tags: force, regenerate thumbnails, thumbnail, thumbnails … … 34 34 35 35 == ChangeLog == 36 37 = 2.3.0 = 38 *Release Date - February 17, 2026* 39 40 * added: WP_CLI command: force-regenerate-thumbnails props @realmranshuman 41 * fixed: PHP 8.5 compatibility 36 42 37 43 = 2.2.2 =
Note: See TracChangeset
for help on using the changeset viewer.