krang_expunge - remove a site or series of sites from a Krang instance, ensuring that no dependencies to those sites exist in the remaining content.
List the actions that would be taken by removing a site (no actions actually taken):
$ krang_expunge --site_id 1
Go through with removing a site and cleaning up dependencies:
$ krang_expunge --site_id 1 --execute
Display more output during the process:
$ krang_expunge --site_id 1 --execute --verbose
Delete elements that link to deleted content, rather than zero them out:
$ krang_expunge --site_id 1 --delete-links --execute
krang_expunge is designed to remove one or more sites from an existing Krang instance, and clean up any links outside of those sites, ensuring that no dependencies remain.
This script was developed in conjunction with the
bin/krang_extract_subset, to make it possible to break up a Krang
instance with multiple sites into multiple instances, with a minimum
of breakage and manual labor.
The idea is to use bin/krang_extract_subset to export a single site
or series of sites (which no longer link to content in surrounding
sites). Once exported, use bin/krang_import to load those sites
into a new Instance, and use bin/krang_expunge to remove that
content from the first Krang instance.
WARNING: Be careful using this script - all deletions and content modifications are final!
Command line options are:
--site_id arguments can
be used to delete multiple sites, e.g.
$ krang_expunge --site_id 1 --site_id 2
krang_expunge to actually go through with the deletion.
Without this argument, krang_expunge will simply display a list of
the changes it will make.
Default behavior is to preserve the elements, but zero out the linked object, so they point to nothing.
The steps taken by krang_expunge are as follows:
site(s) will have the categories within the target site(s) deleted.
All stories that link to stories or media objects within the target
site(s) will have those links removed. If the --delete-links
command-line argument is used, the element will be deleted entirely.
All templates within the target site(s) will be deleted.
All media objects within the target site(s) will be deleted.
All stories within the target site(s) will be deleted.
All categories within the target site(s) will be deleted.
The target site(s) will be deleted.