Making WordPress.org

Changeset 7800


Ignore:
Timestamp:
10/28/2018 10:10:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Plugins: On upload, if a previously rejected plugin with the same slug was found, free up the slug and proceed with the upload.

This brings parity between plugins rejected before and after [5460].

See #3864. See #2737.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-upload-handler.php

    r7385 r7800  
    115115
    116116        $plugin_post = Plugin_Directory::get_plugin_post( $this->plugin_slug );
     117
     118        // Is there a previously rejected plugin with the same slug?
     119        if ( $plugin_post && 'rejected' === $plugin_post->post_status ) {
     120            // Change slug to 'rejected-plugin-name-rejected' to free up 'plugin-name'.
     121            wp_update_post( array(
     122                'ID'        => $plugin_post->ID,
     123                'post_name' => sprintf( 'rejected-%s-rejected', $plugin_post->post_name ),
     124            ) );
     125
     126            $plugin_post = null;
     127        }
    117128
    118129        // Is there already a plugin with the same slug by a different author?
Note: See TracChangeset for help on using the changeset viewer.