Feature #12646

Add new command-line task to delete any Physical storage locations not linked to any descriptions

Added by Mike Cantelon 8 months ago. Updated 3 months ago.

Status:VerifiedStart date:12/18/2018
Priority:MediumDue date:
Assignee:-% Done:

0%

Category:CLI tools
Target version:Release 2.5.0
Google Code Legacy ID: Tested version:
Sponsored:Yes Requires documentation:

Description

This new command-line task will allow a system administrator to identify and delete any containers in the physical storage module that are not linked to any archival descriptions.

If time allows, we will add a --dry-run option to the task, which will allow users to see the console output of containers that will be affected, without actually deleting the affected containers.

See also the related new task for merging duplicate containers, described in Feature #12618

Development tasks:

  • Prepare new task
  • Add matching and update logic
  • Test and document new task

Related issues

Related to Access to Memory (AtoM) - Feature #12618: Add new physical object normalization command-line task t... Verified 12/06/2018

History

#2 Updated by Dan Gillean 8 months ago

  • Target version set to Release 2.5.0
  • Sponsored changed from No to Yes

#3 Updated by Dan Gillean 8 months ago

  • Related to Feature #12618: Add new physical object normalization command-line task to merge duplicate containers added

#4 Updated by Dan Gillean 8 months ago

  • Subject changed from Create new command-line task to delete any Physical storage locations not linked to any descriptions to Add new command-line task to delete any Physical storage locations not linked to any descriptions
  • Description updated (diff)

#5 Updated by Mike Cantelon 4 months ago

  • Status changed from In progress to QA/Review
  • Assignee deleted (Mike Cantelon)

#6 Updated by Dan Gillean 4 months ago

  • Status changed from QA/Review to Feedback
  • Assignee set to Mike Cantelon

I just tried running this in the 18.04 test Vagrant box and got a PHP error:


vagrant$ php symfony physicalobject:delete-unlinked

 Are you sure you'd like to delete all unlinked physical objects?

y

Data before clean-up:
 - 29 physical objects

Detecting unlinked physical objects...
 - 9 physical objects marked for deletion
PHP Fatal error:  Uncaught ArgumentCountError: Too few arguments to function sfCommandApplicationTask::log(), 0 passed in /usr/share/nginx/atom/lib/task/physicalobject/physicalObjectDeleteUnlinkedTask.class.php on line 93 and exactly 1 expected in /usr/share/nginx/atom/vendor/symfony/lib/task/sfCommandApplicationTask.class.php:39
Stack trace:
#0 /usr/share/nginx/atom/lib/task/physicalobject/physicalObjectDeleteUnlinkedTask.class.php(93): sfCommandApplicationTask->log()
#1 /usr/share/nginx/atom/vendor/symfony/lib/task/sfBaseTask.class.php(68): physicalObjectDeleteUnlinkedTask->execute(Array, Array)
#2 /usr/share/nginx/atom/vendor/symfony/lib/task/sfTask.class.php(97): sfBaseTask->doRun(Object(sfCommandManager), NULL)
#3 /usr/share/nginx/atom/vendor/symfony/lib/command/sfSymfonyCommandApplication.class.php(76): sfTask->runFromCLI(Object(sfCommandManager), NULL)
#4 /usr/share/nginx/atom/vendor/symfony/lib/command/cli.php(20): sfSymfonyCommandApplication->run()
#5 /usr/share/nginx/atom/symfony(14): include('/usr/share/ngin...')
#6 in /usr/share/nginx/atom/vendor/symfony/lib/task/sfCommandApplicationTask.class.php on line 39


Some note on the expected behavior, for testing:

Invoking the task

symfony physicalobject:delete-unlinked

Task help:

Usage:
php symfony physicalobject:delete-unlinked [--application[="..."]] [--env="..."] [--connection="..."] [-v|--verbose] [-f|--force] [-d|--dry-run]

Options:
 --application  The application name (default: 1)
 --env          The environment (default: cli)
 --connection   The connection name (default: propel)
 --verbose      (-v) Verbose (shows details of what's marked for deletion
 --force        (-f) Delete without confirmation
 --dry-run      (-d) Dry run (no database changes)

Description:
 Delete physical objects that aren't linked to descriptions

Example output:

 Are you sure you'd like to delete all unlinked physical objects?
y
Data before clean-up:
 - 16 physical objects

Detecting unlinked physical objects...
 - 2 physical objects marked for deletion

Deleting unlinked physical objects...
 - 2 physical objects deleted

Data after clean-up:
 - 14 physical objects

Example output (force, verbose)

Data before clean-up:
 - 31 physical objects

Detecting unlinked physical objects...
 - 12 physical objects marked for deletion

Deleting unlinked physical objects...
 - Name: 'SA-01', Location: 'Research Room Annex, Section C', Type: 'Filing cabinet'
 - Name: 'SA-004', Location: 'Archives Cold Storage, Aisle 1', Type: 'Map cabinet'
 - Name: 'C-006', Location: 'Archives Holdings, Aisle 2, Shelf D', Type: 'Folder'
 - Name: 'C-008', Location: 'Research Room Annex, Section C', Type: 'Hollinger box'
 - Name: 'C-018', Location: 'Archives Cold Storage, Aisle 4, Shelf D', Type: 'Hollinger box'
 - Name: 'CTCC-01', Location: 'Row 6, Shelf C', Type: 'Hollinger box'
 - Name: 'SA-PH', Location: 'Archives Cold Storage, Photograph Room', Type: 'Shelf'
 - Name: 'CTCC-01', Location: 'Row 6, Shelf C', Type: 'Hollinger box'
 - Name: 'Shelf 001', Location: 'Vault', Type: 'Shelf'
 - Name: 'SomeName', Location: 'SomeLocation', Type: 'Box'
 - Name: 'SomeName', Location: 'SomeLocation', Type: 'Cardboard box'
 - Name: 'SomeName', Location: 'SomeLocation', Type: 'Filing cabinet'
 - 12 physical objects deleted

Data after clean-up:
 - 19 physical objects

#7 Updated by Mike Cantelon 4 months ago

  • Status changed from Feedback to Code Review
  • Assignee deleted (Mike Cantelon)

#8 Updated by Mike Cantelon 4 months ago

  • Status changed from Code Review to QA/Review

Merged in qa/2.5.x for QA.

#9 Updated by Dan Gillean 4 months ago

  • Status changed from QA/Review to Verified

Also available in: Atom PDF