Making WordPress.org

Opened 8 years ago

Closed 8 years ago

#2787 closed defect (bug) (fixed)

Plugin Directory: Reject plugin on duplicate slugs

Reported by: ipstenu's profile Ipstenu Owned by: tellyworth's profile tellyworth
Milestone: Priority: normal
Component: Plugin Directory Keywords: has-patch
Cc:

Description

Related to #2386

No one wants 'my-cool-plugin-2' so all plugins with existing slugs should be hard punted and asked to rename.

This should cover all plugins in the queue as well as approved ones (which currently aren't checking for concurrent submissions and some people like to double-click on submit...)

Attachments (2)

2787.patch (1.5 KB) - added by SergeyBiryukov 8 years ago.
2787.2.patch (652 bytes) - added by SergeyBiryukov 8 years ago.

Download all attachments as: .zip

Change History (12)

@SergeyBiryukov
8 years ago

#1 @SergeyBiryukov
8 years ago

  • Keywords has-patch added; needs-patch removed

We already check if the plugin with the same slug exists, but the error is not thrown if the duplicate plugin has a new or pending status.

I think we can just remove the status check there, 2787.patch does that.

This ticket was mentioned in Slack in #meta by ipstenu. View the logs.


8 years ago

#3 @Ipstenu
8 years ago

Line 111:

return sprintf( __( 'There is already a plugin called %1$s. Please change the %2$s line in your main plugin file and upload it again.', 'wporg-plugins' ),

That would be better as:

return sprintf( __( 'You have already submitted the plugin called %1$s. Please be patient and wait for a review. Make sure to whitelist plugins@wordpress.org in your email.', 'wporg-plugins' ),

#4 @tellyworth
8 years ago

  • Owner set to tellyworth
  • Resolution set to fixed
  • Status changed from new to closed

In 5416:

Plugin directory: reject plugin upload on duplicate slug.

Fixes #2787

#5 follow-up: @Ipstenu
8 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening because it's not working.

Someone decided to keep resubmitting when the name was 'wrong' (I need to change THAT error message too...) and we got the same plugin with a -2 appending.

#6 in reply to: ↑ 5 @SergeyBiryukov
8 years ago

Replying to Ipstenu:

Someone decided to keep resubmitting when the name was 'wrong' (I need to change THAT error message too...) and we got the same plugin with a -2 appending.

Just tested on a local install, and [5416] appears to work as expected.

Could it be that it was not deployed yet at the time when that happened?

#7 @SergeyBiryukov
8 years ago

Nevermind, reproduced with a newly submitted plugin (previously tried with a published one).

It's the same issue that was mentioned in comment:4:ticket:2594.

Plugin_Directory::get_plugin_post() includes a list of 7 plugin statuses to query: 'publish', 'pending', 'disabled', 'closed', 'new', 'draft', 'approved', but Plugin_Directory::pre_get_posts() overrides that list and limits the query to 4 statuses 'approved', 'publish', 'closed', 'disabled' (note the lack of 'new'), so the check for duplicate slug is bypassed.

Adding ! $wp_query->is_main_query() to Plugin_Directory::pre_get_posts(), as in
attachment:2594.3.patch:ticket:2594, fixes the issue.

Last edited 8 years ago by SergeyBiryukov (previous) (diff)

This ticket was mentioned in Slack in #meta by sergey. View the logs.


8 years ago

#9 @SergeyBiryukov
8 years ago

Added the relevant part of attachment:2594.patch:ticket:2594 here, just in case: 2787.2.patch.

#10 @tellyworth
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 5500:

Plugin directory: properly fix duplicate plugin slug issue. Props @SergeyBiryukov

Refines earlier fix in [5416]

Fixes #2787

Note: See TracTickets for help on using tickets.