We noticed while trying to update terms that uuids were not being generated. They would only be deleted when a term was deleted, or inserted on creation of a new term. But we needed to update the taxonomy terms with uuids generated from another drupal install. While troubleshooting, we noticed there was no 'update' $op in the uuid_taxonomy() call.

So I decided to write one. In the process, I tried to make some of the other code within the function a little more readable.

I've included a patch which implements update for taxonomy. It is attached to this issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

apotek’s picture

Here's the patch. Thoughts?

(Don't use this one. Use the one in comment 3.)

q0rban’s picture

Title: Update $op support for taxonomy_uuid » Patch: support for update $op in taxonomy_uuid
Issue tags: +Needs tests

subscribe. +1.

apotek’s picture

q0rban identified some oversights in the original extent of the patch. This is fixed in this version. I'm deleting the previous one to keep broken code to a minimum (can't delete the previously uploaded patch. sorry).

markdorison’s picture

Subscribing.

apotek’s picture

Now that I understand the uuid_taxonomy function better, I decided to rewrite it to make it a little more performant and clear.

Here's a better version.

Would love to learn how to write tests for this but also notice that DrupalWebTestCase doesn't have any methods for creating or updating or deleting terms or vocabularies.

K

apotek’s picture

Status: Active » Needs review
apotek’s picture

Looks like the tests were passed. Any other thoughts on this?

ericduran’s picture

Status: Needs review » Reviewed & tested by the community

At 1st I was against this patch, but we can't always assume that all the uuids will be created when the term is 1st inserted.

So this patch makes total sense to me.

We're running this on a production site, without any issues.

mikeryan’s picture

I'd skip the break after the return in the first switch:-), but looks good. +1 good for migration...

Thanks.

apotek’s picture

Thanks for your input, Mike. I go back and forth on the extraneous break; Obviously unnecessary if a return has fired, but it also feels more complete and self-documenting to leave it in there. If the Drupal standard is to not have the break there, I'll remove it, but coder module didn't complain.

apotek’s picture

Just pulled latest from dev and this patch is not there. Any reason from the maintainer this patch is not being committed?

recidive’s picture

Status: Reviewed & tested by the community » Fixed

Just committed the patch in #5 with small code style fixes.

Thanks @apotek!

Automatically closed -- issue fixed for 2 weeks with no activity.