Making WordPress.org

Changeset 2981


Ignore:
Timestamp:
04/19/2016 08:05:57 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Attachments are not 0-based but ID-based.

Makes sure that the submitted zip file gets read and removed when publishing
a new plugin.

See #1570.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/class-status-transitions.php

    r2930 r2981  
    33use WordPressdotorg\Plugin_Directory\Tools;
    44use WordPressdotorg\Plugin_Directory\Tools\SVN;
     5use WordPressdotorg\Plugin_Directory\Tools\Filesystem;
    56
    67/**
     
    5051
    5152        // Read zip and add/commit files to svn.
    52         $attachments   = get_attached_media( 'application/zip', $post_id );
    53         $attachment_id = $attachments[0]->ID;
    54         SVN::add( Filesystem::unzip( get_attached_file( $attachment_id ) ) );
     53        $attachments = get_attached_media( 'application/zip', $post_id );
     54        $attachment  = current( $attachments );
     55        SVN::add( Filesystem::unzip( get_attached_file( $attachment->ID ) ) );
    5556
    5657        // Delete zip.
    57         wp_delete_attachment( $attachment_id, true );
     58        wp_delete_attachment( $attachment->ID, true );
    5859
    5960        // Grant commit access.
Note: See TracChangeset for help on using the changeset viewer.