Making WordPress.org

Changeset 13576


Ignore:
Timestamp:
04/19/2024 03:03:45 AM (10 months ago)
Author:
dd32
Message:

Plugin Directory: Avoid PHP Warnings when the uploaded zip has already been removed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-zip-cleanup.php

    r13109 r13576  
    8989
    9090            // Delete the file hash from the post.
    91             $file_hash = sha1_file( get_attached_file( $attachment ) );
    92             if ( $file_hash ) {
    93                 delete_post_meta( $plugin->ID, 'uploaded_zip_hash', $file_hash );
     91            $file_on_disk = get_attached_file( $attachment );
     92            if ( $file_on_disk && file_exists( $file_on_disk ) ) {
     93                $file_hash = sha1_file( $file_on_disk );
     94                if ( $file_hash ) {
     95                    delete_post_meta( $plugin->ID, 'uploaded_zip_hash', $file_hash );
     96                }
    9497            }
    9598
Note: See TracChangeset for help on using the changeset viewer.