DuplicatedCollectionListener is implemented to respond on the events documentCreatedByCopy and documentCheckedIn.
Then some conditions must be satisfied to handle
- the document must be a collection
- the document must be a folder
I think the second condition was written to handle the case where a folder is copied, but not versioned: if a version of a document is created, then there is no change on its children and there is no need to search collections among the children (unless we are using the tree versioning)
But with the current implementation, the all new versioned folder will be scanned to find collections. Because of the use of "ecm:path STARTSWITH" clause in a query exexuted against the backend, this query can consume a lot of resources in the database, above all for huge folder (more than 100k children)
As this process is not useful for versioned folder, it should be skipped when a folder is versioned and only keep for a folder copy.