• Purge Trash Script - LockException

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #25019  by Catscratch
 
Hi there,

I'm trying to use the Purge Trash script you provided here:
http://wiki.openkm.com/index.php/Script ... sers_trash

But when executing I got a LockException in Line 18:
OKMDocument.getInstance().purge(token, doc.getPath());

Exception:
Code: Select all
target exception : at Line: 18 :   
	.purge ( token , doc .getPath ( ) ) 
  Target exception: com.openkm.core.LockException: 1505bfd9-99e0-4dc2-81dd-5a788aec2d7c : 5355df4f-8d7d-40a8-8482-8e1a3d3fc2a0
Hm. What is the problem here and how to solve it?

Thanks a lot,
regards.

EDIT: The exception occurs on the first user trash that is not empty.
 #25036  by jllort
 
Seems there's a document locked ( can be on edition ) and that's the reason why you're not allowed to delete it.

here you got two uuid, I do not know which is the document uuid should take a look on okm_document_node table to get the document name filtering by uuid you got on error.

Which openkm version are you using ?
 #25040  by Catscratch
 
You're right. The first UUID is the document UUID and I had a look. It is checked out for editing.


I manually cancelt editing.

Now the question is how to solve this problem automatically in the future? Is there a way to extend the purge script to check for a document lock and automatically unlock it?

PS: My OKM version is listed in my signature.
 #25300  by jllort
 
The easiest way is in your code control de LockException ( try catch ) and unlock.
 #25304  by Catscratch
 
Hm, maybe this is a good feature request for your next release. Because it seems like a bug that locked documents stay locked, even in the trash. A document should automatically be unlocked when deleting it (to trash).

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.