Make WordPress Core

Changeset 29728


Ignore:
Timestamp:
09/10/2014 09:56:24 PM (10 years ago)
Author:
wonderboymusic
Message:

Don't overwrite the length property unnecessarily when generating metadata for audio and video files.

Props jrf, wonderboymusic.
Fixes #29176.

File:
1 edited

Legend:

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

    r29721 r29728  
    28612861        if ( ! empty( $data[$version]['comments'] ) ) {
    28622862            foreach ( $data[$version]['comments'] as $key => $list ) {
    2863                 if ( ! empty( $list ) ) {
     2863                if ( 'length' !== $key && ! empty( $list ) ) {
    28642864                    $metadata[$key] = reset( $list );
    28652865                    // Fix bug in byte stream analysis.
     
    29232923        $metadata['mime_type'] = $data['mime_type'];
    29242924    if ( ! empty( $data['playtime_seconds'] ) )
    2925         $metadata['length'] = (int) ceil( $data['playtime_seconds'] );
     2925        $metadata['length'] = (int) round( $data['playtime_seconds'] );
    29262926    if ( ! empty( $data['playtime_string'] ) )
    29272927        $metadata['length_formatted'] = $data['playtime_string'];
     
    29792979        $metadata['mime_type'] = $data['mime_type'];
    29802980    if ( ! empty( $data['playtime_seconds'] ) )
    2981         $metadata['length'] = (int) ceil( $data['playtime_seconds'] );
     2981        $metadata['length'] = (int) round( $data['playtime_seconds'] );
    29822982    if ( ! empty( $data['playtime_string'] ) )
    29832983        $metadata['length_formatted'] = $data['playtime_string'];
Note: See TracChangeset for help on using the changeset viewer.