Here you can find a patch that offers an administration interface to assign users and/or specific content types and/or choosen vocabularies.
Other modules that may need to implements UUID for their own contents can use:
- uuid_create_uuid($oid, $object, $module = 'uuid')
- Store a new UUID in the database
- uuid_get_uuid($oid, $object, $module = 'uuid')
- Retrieve an existing UUID from the database
The function used for creating UUID was taken from the patch suggested by anachivist (http://drupal.org/node/502622#comment-1858190)
The administration panel can be reached here: admin/settings/uuid.
When using the patch, you can delete uuid_node.inc and uuid_user.inc and you have to add the file uuid.admin.inc (@see the ZIP archive).
The ZIP archive contains the entire module.
Comments
Comment #1
b-prod commentedI forgot: the module implements some hooks of the token module (http://drupal.org/project/token).
The token is [uuid-raw] for all objects (node type, user and taxonomy).
Comment #2
recidive commentedHi, thanks for your patch.
Unfortunately, I think your patch was taken against old HEAD code. I've just synced HEAD with DRUPAL-6 branch.
Some of your changes already exist in DRUPAL-6 (and now in HEAD too) like the ability to set which node types should have UUID auto-generated.
The uuid_node.inc and uuid_user.inc don't exist since long time ago.
Can you elaborate on your one-table table approach to store UUIDs for all entities? What it buy us?
I'd appreciate if you cold split your patch by functionality, since there are other issues for some of what you are proposing here, see #502622: UUID() is a non-deterministic function and breaks with replication and #324712: Support Token module. You can concentrate this issue maybe in the database stuff. This is not critical though, since I can as well commit your entire patch. But things like UUID generation need more thought IMO, see discussion in that issue.
Please make another patch so I can review better.
Thanks again.
Comment #3
b-prod commentedHi!
Sorry, I never used CVS before.
I have created a new patch. In it, UUIDs are generated with UUID() for MySQL and PgSQL >= 8.4. For PgSQL < 8.4 (UUID() is not implemented), I use the function suggested by anarchist (#502622: UUID() is a non-deterministic function and breaks with replication)
The main differences are:
I didn't add token and views support to current patch. I will send these patches when you will have reviewed and adapted the code.
There is also the fr.po translation file.
Comment #4
recidive commentedYour changes above does essentially the same as the current code, you can strip that out.
Please avoid that kind of changes as they do nothing besides making it hard to read the patch.
You are removing important code here, that's probably not what you want.
The
uuid_sync()is too much hardcoded for nodes, users and taxonomy, maybe it's time to make this a pluggable system by adding some hooks for other modules to extend functionality.You are removing code that delete module setting on unistallation instead of adding code to remove your new settings.
Can you explain why your 1-table-only approach for storing UUIDs is better than a table for each entity? This can have performance impact e.g. when you have 1M users and 1M nodes, the query will need to search 2M items instead of 1M.
Also, it would help if you can remove the UUID generation stuff from your patch as this is being developed in the other issue.
Tip, taking a patch is not just a matter of replacing module files with your files and taking the patch, what you need to do instead is to take a patch against the code you used as base for doing your changes, and selectively, manually apply to the newer code, then take a patch from it. Also a patch that touches every part of the code is less likely to get commited, since one can agree with part of your code only, and the other part will hold this back. Try to split your patches by functionality. I know this can be tedious, but it's a good way to learn how to make good patches.
Thanks for you contributions!
Comment #5
b-prod commentedAdd support of taxonomy (vocabulary + term).
Comment #6
recidive commentedHello, patch looks ok.
I'm just a bit concerned about using %s placeholder in table and column names in those two queries:
I think it's safer to just concatenate table name/column name instead e.g. changing from
{%s}to{' . $types[$type]['table'] . '}.Also, don't you think 'colname' should be renamed to 'field' just to be inline with schema?
Comment #7
b-prod commentedHi!
I have modified the patch to match your request. You're right, it is more clear like that.
I also corrected the query because uuid_uuid() function is defined in another patch (UUID() is a non-deterministic function and breaks with replication). For the moment we are only speaking about taxonomy so I still use MySQL UUID function.
Comment #8
b-prod commentedThis is the correct patch. Patch above use a '$field' key: it is a mistake.
Comment #9
recidive commentedHi, the patch looks good.
It's missing update function to create the uuid_vocabulary and uuid_term_data tables.
I'd like to commit this but don't have time to test this now.
I'm moving this to needs review in the hope to get some test.
@B-Prod, can you work with some one else to test this for us?
Thank you.
Comment #10
b-prod commentedHi!
Here is a patch which implements hook_update() and adds checkboxes in UUID UI to select which vocabularies to associate with UUID.
Comment #11
ayalon commentedWhat about views argument support? Will this be ever implemented?
It's a bit sad, that this patch never was commited.
Comment #12
recidive commented@ayalon can you test patch in #10 and see if it still applies and work as expected? If so, please move issue status to RTBC and I'll do a final review and commit.
Thanks.
Comment #13
ayalon commentedOk here are my test results:
1. Applied patch without an error to the latest version
2. Activated UUID for a certain vocabulary
3. Saved the settings
4. Updated missing entries
5. Checked the db for UUID -> Everything is there as expected, tables created, entries created
Now I wanted to deploy these UUID with the deploy module
1. Activated the module on the deploy server
2. Deployed a whole vocabulary
3. Checked the term UUID and the vocabulary UUID and -> HURRAY! They were the same!
My vote for commiting this patch!
Comment #14
recidive commentedCommited to Drupal 6 dev branch. Thanks!
Comment #15
ayalon commentedIn addition to this patch I also made a views integration:
It's now possible to pass a taxonomy UUID and a vocabulary UUID as a parameter.
It's also possible to sort and to display the values of taxonomy uuid and vocabulary uuid.
Comment #16
b-prod commentedGreat!
Comment #17
recidive commented@ayalon: could you open a new issue for your patch in #15?
Thanks!