This task was created in response to the bug #1309140: Unable to disable/uninstall.

Drupal core's field module now blocks disabling any module that defines a field type if that field type is still being used in a field instance somewhere. This blocks anyone from disabling this module since some fields get programmatically added during install.

Short term fix in place already:
This is addressed in http://drupalcode.org/project/commerce_file.git/commit/277390f with a temporary fix to set this module's weight heavier than the field module and implementing commerce_file_system_info_alter() to eliminate programmatically controlled fields that will be removed on uninstall of commerce_file.

Long term fix needed:
The commerce_file module needs split into a separate license entity and field module. Then uninstalling the license entity module would remove all field instances allowing the uninstall of the field module.

Comments

recrit’s picture

Priority: Major » Normal
Status: Active » Postponed
bojanz’s picture

Commerce License has been created.
It has been written from scratch and allows for a very wide variety of use cases.

I have just pushed a 7.x-2.x branch of commerce_file that depends on commerce_license (you need 7.x-1.x-dev until I tag an alpha3 / beta1).
I have also created a documentation page at https://drupal.org/node/2043917.
Quoting it:

Difference between Commerce File 1.x and 2.x

  • 1.x implemented all of the licensing logic. This logic has now been generalized and moved into the Commerce License project.
  • 1.x used a custom commerce_file field type for storing licensable files. 2.x uses a normal file field. This allows for compatibility with other contrib modules (such as File Entity) and decreases the amount of code in the commerce_file module.
  • 1.x allowed the number of ip addresses that can access a licensed file to be limited. 2.x removes this functionality, believing that it is redundant in the age of multi-device media consumption.
  • 1.x recorded the purchased files on the license. If the files on the product changed (because the store admin added a new file version, for instance), a manual sync operation had to be invoked to update all of the licenses. 2.x always provides access to the latest files on the product.

So, I've dropped the IP Address limit for the reasons listed above. Another module can readd it and then implement hook_commerce_file_can_download().
The number of downloads limit is now global only. It makes sense to me because this limit is mostly about resource conservation and affects all licensed files. I have no problem with implementing the per-file override too, but it wasn't needed for the MVP so I want to see what the initial feedback is like.

A few screenshots:
1) License settings and File settings
2) product edit form
3) Checkout complete.
This works for anonymous checkout too (and the download works too!)
4) admin license listing
5) user's file view. The expiration column is hidden if no licenses expire. The downloads column is hidden if file_download_count is not enabled, or the download limit is not configured. The file is not linked if download limits have been reached (you just get the plain text label).

brianlp’s picture

Title: Restructure module into a separate license entity module and field module. » Create a 7.x-2.x branch based on commerce_license
Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Postponed » Fixed

This looks spot on for a common download site. Awesome.

Do I understand it right that Commerce License is an add-on to Commere File 1.x and will be included in Commerce File 2.x? (Commerce File isn't listed as dependency)

bohemier’s picture

Awesome bojanz!

This looks very promising... I love the anonymous checkout download function.

thanks for the good work!

bojanz’s picture

@papalapapp
It's the other way around, commerce_file depends on commerce_license (which does most of the work, commerce_file is just a thin wrapper).

bojanz’s picture

Next steps: #2047035: Reimplement custom download logging, as a part of the effort to support license renewals, and after that is done, testing with Amazon S3.

Status: Fixed » Closed (fixed)

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