Reviewed & tested by the community
Project:
File Lock
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
9 Oct 2013 at 05:57 UTC
Updated:
10 Jun 2016 at 01:00 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
gaellafond commentedSolution:
File: file_lock.install
changed to:
If you want to use the function "file_lock_remove_lock" instead of file_usage_delete (which would be a good idea), you should define "file_lock_remove_lock" in a separate file (file_lock.inc) that you include in the .module and the .install using:
require_once (dirname(__FILE__) . '/file_lock.inc');The constant "FILE_LOCK_ID" should also be defined in that file as well, and the "file_lock_add_lock" for consistency.
Comment #2
gaellafond commentedPatch
* Remove lock on all locked files, when uninstall is run,
* Added a file_lock.inc containing common functions,
* Added a list of module files and the link to the module config page in the .info
Comment #2.0
gaellafond commentedBetter formating
Comment #3
xtfer commentedComment #4
mikeytown2 commentedComment #5
anybody+1 for RTBC from my side. Important patch that works good for me!
Comment #6
mikeytown2 commentedComment #7
loopduplicate commentedHi All,
I changed this to a bug because it seems like leaving behind stale file usage entries after uninstall is a bug. Feel free to disagree and change back.
The patch in #2 no longer applies, so I'm uploading a revised patch as well as making a few comments about the patch in #2:
The new patch I'm uploading does not include a new include file.
There is no need to add these to the .info files array:
In the new patch, instead of using these two functions, hook_uninstall() uses the code from those functions inline. Incidentally, file_lock_remove_lock() was removed from this module since the time that the patch in #2 was made.
The new patch doesn't call an external function, instead it has a few lines of inline code
Regards,
loop
Comment #8
aimeeraeHi loop, I tested your patch in https://www.drupal.org/node/2107925#comment-11280851 and the file locks are deleted after the uninstall of the module.
Note: files that are in use by other modules (node, etc) are still locked, as they should be.
Files that were only locked by the file_lock module can be deleted after the module is not just disabled, but uninstalled.