Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This is not really usual, but hook_uninstall()
is intended to remove all about the module, so we need to do it to avoid problems on re-installing.
Two alternatives:
- AFAIK drupal file subsystem does not have a recursive directory remove function, so I think looking how this is done in other modules like imce_mkdir(on commit 127221) is the better idea for now.
- Since we know how xapian DB is structured: one directory level with files: asume it and do simple unlink's + rmdir
Thinking a little about it before do it :-p
Comment | File | Size | Author |
---|---|---|---|
#6 | 0001-Issue-695562-Remove-local-xapian-database-on-uninsta.patch | 1.96 KB | marvil07 |
#1 | 0001-bug-695562-by-marvil07-remove-local-xapian-db-on-uni.patch | 1.41 KB | marvil07 |
Comments
Comment #1
marvil07 CreditAttribution: marvil07 commentedusing the simple approach
Comment #2
rboulton CreditAttribution: rboulton commentedIn the general case, it's not safe to assume that about xapian databases. In particular, xapian databases which have been produced by replication (not yet a released feature...) will consist of a directory containing one or two subdirectories at any given time. It's also conceivable that future backends may store some data within further subdirectories.
Comment #3
marvil07 CreditAttribution: marvil07 commentedSo, if we assume we could have subdirectories on the xapian db, we should not delete that directory, but then, we should change how the index work, to avoid problem on "reinstall", but I think it's not so relevant for now because people uninstalling xapian knows they should remove data before re-installing.
Well, not really sure what to do, some more feedback about other cases would be great!
Comment #4
marvil07 CreditAttribution: marvil07 commentedOk, to resolve this I need to have different types of cases in my local environment.
rboulton: can you please point me to the right xapian link documentation to replicate your case?
Comment #5
marvil07 CreditAttribution: marvil07 commentedWell, actually until be sure, just let the index files there :-/
It would be great if someone can help me to replicate how to have subdirectories in the xapian index.
Comment #6
marvil07 CreditAttribution: marvil07 commentedOk, I end up writing a recursive directory removal since I could not find any drupal fancy function for it, but it's done and on upstream now.
Attaching the patch for reference.
Comment #7
marvil07 CreditAttribution: marvil07 commentedupps, see follow up.