NAME

krang_extract_subset - creates subsets of .kds files created by bin/krang_export.


SYNOPSIS

Create a new .kds file of all content under a specific site:

  $ krang_extract_subset --site_id 1

Create a new .kds file based on a series of sites:

  $ krang_extract_subset --site_id 1 --site_id 2 --site_id 3

Output the resulting .kds file to a different filename:

  $ krang_extract_subset --site_id 1 --output site_1.kds

See more of what is going on during the process:

  $ krang_extract_subset --site_id 1 --verbose


DESCRIPTION

This script is designed to extract one or more sites from a Krang instance, and save them as a Krang DataSet (.kds) file, akin to those created by krang_export.

This script is designed to generate a data subset, based on a Krang instance, specific to a single site or series of sites. To do this, Krang objects may be modified to eliminate dependencies.

REPEAT: Krang objects may be modified as part of the process!

The process works as follows (assuming that a subset is to be created for --site_id 1:

NOTE: Once again: THE RESULTING DATASET IS NOT IDENTICAL TO THE ORIGINAL DATA!!

This script breaks links. The dataset output by this script is designed to exist on its own, with all external dependencies removed. This new dataset is not consistent with the original data!

Note that this script does not modify anything in the original data. It does not modify anything in any running Krang instances. It simply creates a newly-scrubbed data file. That being said, this data file is not consistent with any other dumps you may have.

A final example on what all the warnings above are about:

  # Krang Instance contains SiteA (id=1) and SiteB (id=2).
  # SiteA and SiteB have a number of stories that exist under both
  # sites, and stories that link from stories in SiteA to stories in
  # SiteB
  $ bin/krang_extract_subset --site_id 1 --output siteA.kds
  $ bin/krang_extract_subset --site_id 2 --output siteB.kds
  # we now have distinct exports for each site.  However, all links
  # between SiteA and SiteB are gone.  Stories that existed in both
  # sites now exist separately in each site.
  # re-import into a new instance.
  $ bin/krang_import siteA.kds
  $ bin/krang_import siteB.kds
  # While the two sites have been restored, they are not identical to
  # those in the original instance from which they came.

In closing, BE VERY CAREFUL WHEN USING THIS SCRIPT.