Make WordPress Core

Opened 17 years ago

Closed 14 years ago

Last modified 14 years ago

#4603 closed enhancement (worksforme)

wp.newCategory should prevent adding multiple categories of the same name/slug/parent

Reported by: redsweater's profile redsweater Owned by: josephscott's profile josephscott
Milestone: Priority: normal
Severity: normal Version: 2.2.1
Component: XML-RPC Keywords:
Focuses: Cc:

Description

This bug is related to http://trac.wordpress.org/ticket/3683 but is intended specifically as a behavior request for wp.newCategory in the XMLRPC-WP interface.

Currently wp.newCategory will happily assign new category IDs for the same term with the same slug at the same hierarchical level. This seems highly unlikely to be in the spirit of what any client is requesting, so to protect the category structure, I propose the following change:

IF the requested category name, slug, and parent ID all match an existing category in the targeted blog, return the existing category ID as if it had just been created.

This would have the happy coincidence of covering a race condition problem that might exist if two users were authorized to edit the same blog, and both submitted changes that caused an identical "newCategory" call to be made at the same time.

Change History (9)

#1 @foolswisdom
17 years ago

  • Milestone set to 2.4 (future)

#2 @josephscott
17 years ago

  • Cc josephscott added

#3 @Denis-de-Bernardy
16 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I've lost count of the number of dups of this one. Look into the Taxonomy component to find a few more of the same issue.

#4 @redsweater
16 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

I think it's dangerous to close bugs as "duplicate" without referencing a specific example of what it is being considered a duplicate of. It's too easy to misunderstand the nuances of the actual bug report. Citing an original gives the original reporter a chance to clearly evaluate whether the original bug is in fact a duplicate, or merely a related issue.

If you don't mind finding at least one example for which this is a duplicate, that will probably also be useful to make a note of so that you can have it handy when you inevitably run into the other bugs which you also consider duplicates.

#5 @Denis-de-Bernardy
15 years ago

  • Milestone set to Future Release
  • Type changed from defect (bug) to enhancement

the real issue is not in xmlrpc but in that we've a terms table underneath.

See #3799, #3683, #6211, #6542, #5034, #8167, as examples.

Please re-close this one after taking a look at them, unless this ticket has an extra bit.

#6 @solarissmoke
14 years ago

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

In trunk, if you try to add a category that already exists, wp_newCategory returns the ID of the already existing category instead of creating a duplicate. Which is what this ticket was asking for.

#7 @nacin
14 years ago

  • Milestone Future Release deleted
  • Resolution fixed deleted
  • Status changed from closed to reopened

#8 @nacin
14 years ago

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

#9 @redsweater
14 years ago

I can confirm that this is fixed in trunk. I tested a scenario where wp.newCategory is sent to a blog providing a redundant term name with a category that already exists, and the server happily returned the term ID for the existing category.

Note: See TracTickets for help on using tickets.