Make WordPress Core

Changeset 28959


Ignore:
Timestamp:
07/02/2014 02:36:29 PM (11 years ago)
Author:
SergeyBiryukov
Message:

Avoing a PHP warning in media modal if the attached file does not exist.

props kovshenin.
see #24716.

File:
1 edited

Legend:

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

    r28923 r28959  
    26322632    }
    26332633
    2634     $bytes = filesize( get_attached_file( $attachment->ID ) );
    2635     $response['filesizeInBytes'] = $bytes;
    2636     $response['filesizeHumanReadable'] = size_format( $bytes );
     2634    $attached_file = get_attached_file( $attachment->ID );
     2635    if ( file_exists( $attached_file ) ) {
     2636        $bytes = filesize( $attached_file );
     2637        $response['filesizeInBytes'] = $bytes;
     2638        $response['filesizeHumanReadable'] = size_format( $bytes );
     2639    }
    26372640
    26382641    if ( current_user_can( 'edit_post', $attachment->ID ) ) {
Note: See TracChangeset for help on using the changeset viewer.