• Error while purging trash

  • 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.
 #43229  by openkm_user
 
Hi,

We have around 10,000 documents in Trash which we are trying to Purge, under username there are 60 folder each folder containing 200 folders inside, in which there are documents ranging from 1 to 50 documents.

-username
--folder1
---innerfolder1
----document1
----document2
----***
----***
----documentn
---innerfolder2
---innerfolder3
---***
---***
---innerfolder200
--folder2
--folder3
--***
--***
--folder60

When I try to Purge it does not delete anything and keeps returning the following errors,
okm_trash_db_error.JPG
okm_trash_db_error.JPG (20.11 KiB) Viewed 1280 times
okm_trash_db_error_n.JPG
okm_trash_db_error_n.JPG (22.16 KiB) Viewed 1280 times
We are able to delete innerfolders if we tried to do so, seems like a problem if done in bulks.

Is there any other way to Purge Trash? Please advice!
 #43240  by jllort
 
The problem in community version while purge files is that all is still done in a single database transaction. That has been corrected in professional.

The problem could be is raising SQL exception what stops the process or similar thing and you are not seeing the real error. Anyway the best option I can offering you is script to iterate along all the folders and then purge step by step.
Code: Select all
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.openkm.api.*;
import com.openkm.bean.*;
 
Logger log = LoggerFactory.getLogger("com.openkm.scripting");
int MAX_DEPTH = Integer.MAX_VALUE;
 
void nodeTask(String path, int depth) throws Exception {
    for (Document doc : OKMDocument.getInstance().getChildren(null, path)) {
        log.info("Document: {}", doc.getPath());
        // Here purge the document one by one
    }
 
    for (Folder fld : OKMFolder.getInstance().getChildren(null, path)) {
        log.info("Folder: {}", fld.getPath());
 
        if (depth < MAX_DEPTH) {
            nodeTask(fld.getPath(), depth + 1);
        }
    }
}
 
log.info("***** Process BEGIN *****");
nodeTask("/okm:trash", 0);
log.info("***** Process END *****");

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.