| 2619 | if ( $attachment_id && preg_match( '#^(audio|video)#', $post->post_mime_type ) ) { |
| 2620 | $file = get_attached_file( $attachment_id ); |
| 2621 | $meta = wp_get_attachment_metadata( $attachment_id ); |
| 2622 | if ( empty( $meta ) && file_exists( $file ) ) { |
| 2623 | $_meta = get_post_meta( $attachment_id ); |
| 2624 | $regeneration_lock = 'wp_regenerating_' . $attachment_id; |
| 2625 | if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) { |
| 2626 | set_transient( $regeneration_lock, $file ); |
| 2627 | wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) ); |
| 2628 | delete_transient( $regeneration_lock ); |
| 2629 | } |
| 2630 | } |
| 2631 | } |
| 2632 | |