[wp-hackers] GSoC 2013: UUID Abstraction

Aniket Pant me at aniketpant.com
Fri Apr 26 21:24:23 UTC 2013


Hey everyone,

I'm Aniket (http://www.aniketpant.com), a third year undergraduate
pursuing Mechanical Engineering at BITS Pilani - Goa Campus. I started
web development with Codeigniter and after sometime picked up
WordPress for developing small applications, themes and plugins. I
have also spoken at two WordCamps in India, once on theme development
and the other time on using metaboxes effectively.

I planned to apply for GSoC 2012, but WordPress wasn't selected as a
mentoring organization and I ended up getting busy during the summer
with an internship. This year, while going through the ideas list, I
was happy to see some of the old ideas back. In the last two weeks, I
have opened some tickets and wrote a patch. Just trying to get the
hang of the way WordPress development functions.

I was planning to work towards Import/Export operations but my current
understanding of the JSON based output is not sound. Somehow, I missed
out on the UUID Abstraction Project while going through the list
earlier and saw it sometime back. Just wanted to share my understand
of the project and get some feedback on it.

## The basic idea

This project is interesting because it is one of those projects which
can actually go into the release cycle if the work is done right and
the end result doesn't hamper any of the existing code. On reading
through the data available on UUIDs, a number of variants are
available. I feel that v5 which uses a SHA-1 hash is a suitable choice
even from the security point of view. A v5 UUID is generated by
providing a namespace and a name. Given the same name and the
namespace, the generated output will be the same.

## How UUIDs can be generated?

I searched around the net and found this -
https://gist.github.com/dahnielson/508447. The mentioned file contains
functions for generating v3, v4, v5 UUIDs.

## What namespace can be used?

The namespace can be any of the following -
- A unique string provided by the user during install/setup
- The website name (but this can be similar in case of two websites,
not sure if it will affect anything in any case)
- A fixed/common UUID for all installations (not sure if this is a
really good idea)
- A random UUID created via a v4 UUID generator

This can be converted to a UUID as the namespace needs to be another UUID.

## Change in the user table

A new column for UUID will be introduced where the username will be
used as the name for generating the UUID. Since the username is a
mandatory field, it will always be present.

namespace + username = User UUID

## Change in the posts table

This table already contains a GUID which is in the form of a URL. It
is unique, but for consistency it is logical to implement a UUID in
this scenario. Similarly over here, the name provided for generating
the UUID can be provided as the post title.

Removal of GUID will not make sense because it is used all over the
software for generating the URL in many places. Instead the field can
be modified and updated to use UUID in it's place.

## How the changes will be carried out?

A tool can be introduced to do this. It will run all user and post
entries through it and generate UUIDs for them.

This is what I have been able to think so far. I would really love to
get some insights for my approach and what I might be planning
incorrectly.

Cheers!

Aniket


More information about the wp-hackers mailing list