Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail gracefully if the output directory does not already exist #63

Open
wants to merge 2 commits into
base: 7.x
Choose a base branch
from

Conversation

ctgraham
Copy link

JIRA Ticket: N/A

Present a warning if the output directory does not exist when bagging object

I configured the module without also creating the "Output directory for serialized Bags", and was greeted with the following messages on a drush run:

mkdir(): No such file or directory bagit.php:611                                                         [warning]
mkdir(): Permission denied bagit.php:617                                                                 [warning]
touch(): Unable to create file /manifest-sha1.txt because Permission denied bagit_manifest.php:113       [warning]
file_put_contents(/bagit.txt): failed to open stream: Permission denied bagit_utils.php:252              [warning]
touch(): Unable to create file /tagmanifest-sha1.txt because Permission denied bagit_manifest.php:113    [warning]
touch(): Unable to create file /bag-info.txt because Permission denied bagit.php:656                     [warning]
mkdir(): Permission denied bagit.php:435                                                                 [warning]
copy(/data/foo.xml): failed to open stream: No such file or directory bagit.php:438                      [warning]
mkdir(): Permission denied bagit.php:435                                                                 [warning]
copy(/data/RELS-EXT.rdf): failed to open stream: No such file or directory bagit.php:438                 [warning]

What's new?

Adds a Drupal messaging and an Exception thrown if the output directory does not exist.

This prevents a slew of impossible operation attempts.

How should this be tested?

  • Configure without a valid output directory
  • Run a drush bagging operation

Additional Notes:

N/A

Interested parties

@Islandora/7-x-1-x-committers

@mjordan mjordan self-requested a review February 12, 2021 23:06
@mjordan mjordan self-assigned this Feb 12, 2021
@mjordan
Copy link
Contributor

mjordan commented Feb 12, 2021

Thanks! I will review and test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants