Making WordPress.org

Changeset 2995


Ignore:
Timestamp:
04/21/2016 08:07:36 PM (9 years ago)
Author:
obenland
Message:

Plugin Directory: Don't process publish transition twice.

Bails if the plugin has been published before.

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

    r2981 r2995  
    3636     */
    3737    public function publish( $post_id, $post ) {
     38        $attachments = get_attached_media( 'application/zip', $post_id );
     39
     40        // If there is no zip we have nothing to commit. Bail.
     41        if ( empty( $attachments ) ) {
     42            return;
     43        }
     44
     45        $attachment    = current( $attachments );
    3846        $plugin_author = get_user_by( 'id', $post->post_author );
    3947
     
    5159
    5260        // Read zip and add/commit files to svn.
    53         $attachments = get_attached_media( 'application/zip', $post_id );
    54         $attachment  = current( $attachments );
    5561        SVN::add( Filesystem::unzip( get_attached_file( $attachment->ID ) ) );
    5662
Note: See TracChangeset for help on using the changeset viewer.