WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/07/2014 10:40:32 PM (8 years ago)
Author:
wonderboymusic
Message:

Introduce maybe_regenerate_attachment_metadata( $attachment ). On the Edit Media screen, call it for Audio and Video files.

The functions checks if the item is lacking metadata altogether. If a video or audio file was uploaded prior to 3.6, it does not have any metadata. This tries to fix it. Implements locking via a transient to protect against this running in parallel with another request.

This is the minimum viable product for #26825, but leaving the ticket open unless this function needs to be called in other places.

See #26825.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r27036 r27127  
    26372637    elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'audio/' ) ):
    26382638
     2639        maybe_regenerate_attachment_metadata( $post );
     2640
    26392641        echo wp_audio_shortcode( array( 'src' => $att_url ) );
    26402642
    26412643    elseif ( $attachment_id && 0 === strpos( $post->post_mime_type, 'video/' ) ):
     2644
     2645        maybe_regenerate_attachment_metadata( $post );
    26422646
    26432647        $meta = wp_get_attachment_metadata( $attachment_id );
Note: See TracChangeset for help on using the changeset viewer.