From a71b585e5e1aa13f716352644a0dfb8654b94c68 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Tue, 1 Mar 2016 11:23:41 -0400 Subject: [PATCH 1/2] Keep supporting target parameter, fix broken preprocessor. --- islandora_book_batch.drush.inc | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/islandora_book_batch.drush.inc b/islandora_book_batch.drush.inc index 702c330..ceb6745 100644 --- a/islandora_book_batch.drush.inc +++ b/islandora_book_batch.drush.inc @@ -22,10 +22,6 @@ function islandora_book_batch_drush_command() { 'description' => 'Either "directory" or "zip".', 'required' => TRUE, ), - 'scan_target' => array( - 'description' => 'The target to directory or zip file to scan.', - 'required' => TRUE, - ), 'namespace' => array( 'description' => 'The namespace for objects created by this command. Defaults to namespce set in fedora config.', 'required' => FALSE, @@ -87,7 +83,22 @@ function islandora_book_batch_drush_command() { ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_LOGIN, ); - + // XXX: The target parameter became reserved in Drush 7 and above, for + // backwards compatibility both will be supported. Not using + // strict-option-handling (http://www.drush.org/en/master/strict-options) as + // it requires manual argument parsing. + if (drush_core_version() >= 7) { + $items['islandora_book_batch_preprocess']['options']['scan_target'] = array( + 'description' => 'The target to directory or zip file to scan.', + 'required' => TRUE, + ); + } + else { + $items['islandora_book_batch_preprocess']['options']['target'] = array( + 'description' => 'The target to directory or zip file to scan.', + 'required' => TRUE, + ); + } return $items; } @@ -104,7 +115,7 @@ function drush_islandora_book_batch_preprocess() { $parameters = array( 'type' => drush_get_option('type'), 'namespace' => drush_get_option('namespace'), - 'scan_target' => drush_get_option('scan_target'), + 'target' => drush_core_version() >= 7 ? drush_get_option('scan_target') : drush_get_option('target'), 'parent' => drush_get_option('parent', 'islandora:bookCollection'), 'parent_relationship_uri' => drush_get_option('parent_relationship_uri', 'info:fedora/fedora-system:def/relations-external#'), 'parent_relationship_pred' => drush_get_option('parent_relationship_pred', 'isMemberOfCollection'), From 1ef3354550ce4bc239ba5c68bc14f4da6b5117e2 Mon Sep 17 00:00:00 2001 From: Jordan Dukart Date: Tue, 1 Mar 2016 14:29:48 -0400 Subject: [PATCH 2/2] Update README. --- README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 43d4fc9..62638b0 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,18 @@ Further documentation for this module is available at [our wiki](https://wiki.du The base ZIP/directory preprocessor can be called as a drush script (see `drush help islandora_book_batch_preprocess` for additional parameters): +Drush made the `target` parameter reserved as of Drush 7. To allow for backwards compatability this will be preserved. + +Drush 7 and above: + `drush -v --user=admin --uri=http://localhost islandora_book_batch_preprocess --type=zip --scan_target=/path/to/archive.zip` +Drush 6 and below: +`drush -v --user=admin --uri=http://localhost islandora_book_batch_preprocess --type=zip --target=/path/to/archive.zip` + This will populate the queue (stored in the Drupal database) with base entries. -Books must be broken up into separate directories, such that each directory at the "top" level (in the scan_target directory or Zip file) represents a book. Book pages are their own directories inside of each book directory. +Books must be broken up into separate directories, such that each directory at the "top" level (in the target directory or Zip file) represents a book. Book pages are their own directories inside of each book directory. Files are assigned to object datastreams based on their basename, so a folder structure like: