Bug 16291 - koha-remove --purge should also delete '/etc/koha/sites/$instance' dir
Summary: koha-remove --purge should also delete '/etc/koha/sites/$instance' dir
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Robin Sheat
QA Contact: Testopia
URL:
Keywords:
: 13902 (view as bug list)
Depends on: 9754
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-19 04:27 UTC by Mason James
Modified: 2025-11-29 00:01 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes the koha-remove --purge package command so that the instance name's directory is completely removed, even if it has additional files in it. Previously, the instance's directory wasn't removed if there were other files in it, which could cause problems when creating a new instance with the same name.
Version(s) released in:
Circulation function:


Attachments
Bug 16291: remove /etc/koha/sites/$name on koha-remove --purge-all (1.42 KB, patch)
2025-11-23 01:15 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 16291: Remove /etc/koha/sites/$name on koha-remove --purge-all (1.47 KB, patch)
2025-11-28 23:57 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mason James 2016-04-19 04:27:51 UTC
It would be useful if 'koha-remove --purge' also deleted a /etc/koha/sites/instance dir
Comment 1 Mason James 2016-05-18 02:06:54 UTC
*** Bug 13902 has been marked as a duplicate of this bug. ***
Comment 2 Robin Sheat 2025-11-23 01:15:58 UTC
Created attachment 189899 [details] [review]
Bug 16291: remove /etc/koha/sites/$name on koha-remove --purge-all

A purge leaves behind some traces in /etc/koha/sites/$name, which can cause problems because the directory isn't deleted. This deletes the whole shebang when purge is requested.

Test plan:
1. With the packages installed, make an instance.
2. Make a file in there, e.g. `# cat hello > /etc/koha/sites/$name/foo.txt`
3. Delete the instance with `koha-remove $name --purge-all`
4. Verify that `/etc/koha/sites/$name no longer exists
Comment 3 David Nind 2025-11-28 23:57:28 UTC
Created attachment 190041 [details] [review]
Bug 16291: Remove /etc/koha/sites/$name on koha-remove --purge-all

A purge leaves behind some traces in /etc/koha/sites/$name, which
can cause problems because the directory isn't deleted. This deletes
the whole shebang when purge is requested.

Test plan:
1. With the packages installed, make an instance.
2. Make a file in there, e.g. `# cat hello > /etc/koha/sites/$name/foo.txt`
3. Delete the instance with `koha-remove $name --purge-all`
4. Verify that `/etc/koha/sites/$name no longer exists

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 David Nind 2025-11-29 00:01:33 UTC
Testing notes (using KTD):

1. Create an instance: sudo koha-create --create-db testkoha 

2. Create a file: sudo vi /etc/koha/sites/testkoha/foo.txt

3. Change permissions: sudo chown root:testkoha-koha /etc/koha/sites/testkoha/foo.txt

4. Remove: sudo koha-remove testkoha --purge-all

5. I shut down KTD and restarted it with the patch applied, but I'm not sure if that was necessary.