Make WordPress Core

Ticket #42017: 42017.diff

File 42017.diff, 1.4 KB (added by desrosj, 6 years ago)
  • src/wp-admin/includes/media.php

     
    33843384                $metadata['length_formatted'] = $data['playtime_string'];
    33853385        }
    33863386
     3387        if ( empty( $metadata['created_timestamp'] ) ) {
     3388                $created_timestamp = wp_get_media_creation_timestamp( $data );
     3389
     3390                if ( false !==  $created_timestamp ) {
     3391                        $metadata['created_timestamp'] = $created_timestamp;
     3392                }
     3393        }
     3394
    33873395        wp_add_id3_tag_data( $metadata, $data );
    33883396
    33893397        return $metadata;
  • tests/phpunit/tests/media.php

     
    23442344        }
    23452345
    23462346        /**
     2347         * Test created timestamp is properly read from an MP4 file.
     2348         *
     2349         * This MP4 video file has an AAC audio track, so it can be used to test
     2350         *`wp_read_audio_metadata()`.
     2351         *
     2352         * @ticket 42017
     2353         */
     2354        function test_wp_read_audio_metadata_adds_creation_date_with_mp4() {
     2355                $video    = DIR_TESTDATA . '/uploads/small-video.mp4';
     2356                $metadata = wp_read_audio_metadata( $video );
     2357
     2358                $this->assertEquals( 1269120551, $metadata['created_timestamp'] );
     2359        }
     2360
     2361        /**
    23472362         * @ticket 35218
    23482363         */
    23492364        function test_wp_read_video_metadata_adds_creation_date_with_quicktime() {