Aaaa... So I just rewrote uc_license_keys a week or so ago...

mradcliffe - November 12, 2009 - 14:02
Project:Ubercart Product Keys
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

So I pretty much rewrote uc_license_keys for an internal site just the other day. I didn't really care much for the 6.x port that was posted on the comments page. I'm glad I was pointed to this recently released module as I was about to create a new project myself. ;-)

uc_license_keys has an odd schema imo hooking into order_id and model (sku) though you're probably already familiar with it. Using the model runs into a few issues like trying to use the same license key on a different sku purchase although that's solved via a sub-module to shift things over at sku change (out of scope of uc_license_keys).

Some other random thoughts:

  • I decided to rewrite and use views to generate admin and key pages. Though as mentioned, the sku/model schema made it kind of weird
  • the api I added let other developers return a custom form rather than keys... not sure which is better
  • mmmm... conditional actions...
  • is the robust schema necessary in all use cases or should you leave that to sub-modules and customization? Some fields are redundant like uid, which is already associated via the order_id. Pkid seems redundant. The unique number is the serial/product key, right? You don't want the same product key sold that would unlock multiple products? Or maybe that's an option with product sequerences..?
  • Activations? Great idea.
  • Upgrade paths for older modules like uc_license_keys...
  • uc_license_keys assumes that keys associate with a sku version of a product node. So any of the keys would work with that sku. Is the idea behind activations and product sequences so you can manage product/license keys and track usage all on the same web site?

Interested in maybe collaborating a bit.

#1

mradcliffe - November 23, 2009 - 19:30

A new module appears, licensing.

I'm going to create a post on groups.drupal.org Similar Module Review (formerly hall of shame) for collaboration.

#2

freixas - December 15, 2009 - 00:21

Sorry, but I never received your posting. I have no idea why. I have another module, uc_addresses, and I seem to get all the messages posted there. I also checked all my email (I don't delete much) and couldn't find your postings.

Regarding your random thoughts:

  • Using views sounds like a good idea. I thought about it, but just don't have a great deal of experience with integrating with views. Interested in collaborating on adding views support?
  • I'd need to know more.
  • The schema so non-programmers can have a working system, Sub-modules could solve the problem, but none exist (yet). It might be possible to refactor the code later to separate functionality. uid is included in the order, but sometimes you'd rather avoid the extra join or database fetch. I think I might have started out without it and then added it to avoid some database operations. Finally, I'm embarrassed to tell you how long my product keys are. My theory is that the database index is going to be a lot smaller if it is based on an integer than the a lengthy product key—and it may operate faster. This is also the reason that I avoided creating a unique index for product keys—it could affect performance. I am not a database guru, though, so I might be wrong.
  • Thanks.
  • I'm not a uc_license_keys user, but if anyone would like to provide the code for an upgrade path, they would be welcome,
  • First, uc_product_keys associates a key with a product in the same way that uc_license_keys associates a key with an SKU. Any of the keys work with the given product. Why not use the SKU? I wanted to allow two products to use keys from the same pool (for example, several betas might use the same beta product key). There are two ways to do this: In the product sequences, I could create a bunch of fields to create associations to products or in each product I could provide an association with one sequence. I prefered the latter. Because products may have variant SKUs in a variety of places, it was simpler to associate the product with a sequence than an SKU with a sequence. Product sequences provide a place to store certain characteristics of a sequence, such as whether it is dynamically generated or imported.

Regarding the multiplicity of Drupal modules dealing with licensing: uc_license_keys is not an official Drupal module, so when I created uc_product_keys, there was no duplication.

It may be possible to rework the code to use the Licensing module. I don't know much about it yet and the author has never contacted me (as far as I know—the email system may be flaky). The description seems to claim it does not duplicate uc_product_keys.

Sorry for the later reply and thanks for your input.

 
 

Drupal is a registered trademark of Dries Buytaert.