mjordan / islandora_bulk_delete

A utility module that does one thing: deletes all the objects in an Islandora collection (or optionally, all issues and pages in a newspaper object). Use this tool carefully. It is dangerous.
GNU General Public License v3.0
7 stars 4 forks source link

Islandora Bulk Deleter

A utility module that does one thing: deletes all the objects in an Islandora collection, all issues and pages in a newspaper object, or all objects with a specific namespace. Use this tool carefully. It is dangerous.

Requirements

Installation

  1. git clone https://github.com/mjordan/islandora_bulk_delete.git
  2. drush en -y islandora_bulk_delete

Usage

There is no graphical user interface for this module. It only provides one drush command, drush islandora_bulk_delete_delete, or drush iChainsaw for short.

When you run the command, it tells you how many objects it is going to delete, and prompts you to make sure you want to go ahead. If you say 'y', it does to the resulting objects what a chainsaw does to the branches of a tree. If you say 'n', drush exits without doing anything.

However, there is a safety switch on this chainsaw. If you include the --list option, the objects are only listed and not deleted. The --list option does not take a value, unlike the other options described below.

To delete objects (to purge them, to use FedoraCommons' terminology), issue a command with one of the following templates:

The --collection, --content_model and --namespace parameters are optional, and provide three ways to limit the set of objects to be deleted. If you include them, only objects in the specified collection of the specified content type and/or having the specified namespace will be deleted. The --user needs to have Drupal permission to "Permanently remove objects from the repository." The values of the --collection and --content_model options are PIDs.

Options also exist for specifying which Solr fields to use for content model, collection membership, and newspaper issue membership. Run drush iChainsaw --help for more detail.

The specified collection (or newspaper) object is not deleted, unless it has a namespace that is specified when only the --namespace option is used. For newspaper issues and book objects, all associated page objects are deleted. Please note that an object is deleted even if it is in another collection. It is not simply removed from the current collection.

If you have a list of PIDs you want to delete, you can use --pid_file instead of the other options. The value of --pid_file should be the absolute path to a text file containing one PID per row. Lines that start with a # or // are ignored. For example, if you had a PID file at /tmp/mypidfile.txt that contained the following:

islandora:1000
# This line is ignored.
islanodra:1120
islandora:6

and issued the command drush iChainsaw --user=admin --pid_file=/tmp/mypidfile.txt, objects with those three PIDs would be deleted. The only other option you can use in conjuction with --pid_file is --list, which will just list the PIDs named in your file the same way it does if you use one of the query options.

Newspapers are a special case:

Maintainer

License and Terms of use