MarcusBarnes / mik

The Move to Islandora Kit is an extensible PHP command-line tool for converting source content and metadata into packages suitable for importing into Islandora (or other digital repository and preservations systems).
GNU General Public License v3.0
34 stars 11 forks source link

CsvCompound fails to create directories #511

Open bondjimbond opened 4 years ago

bondjimbond commented 4 years ago

If your output directory doesn't exist, checkconfig all will tell you "The path /Path/To/Target/(defined in configuration setting output_directory) does not exist but will be created for you."

This is not true. If you run MIK, you get errors:

ErrorException.ERROR: ErrorException {"message":"mkdir(): No such file or directory","code":{"metadata":"<?xml version=\"1.0\"?>\n<mods xmlns=\"http://www.loc.gov/mods/v3\" xmlns:mods=\"http://www.loc.gov/mods/v3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n  <titleInfo>\n    <title>Anthony McNab Favel Performance Art Cabaret</title>\n  </titleInfo>\n  <abstract>Anthony McNab Favel's piece in the Performance Art Cabaret.</abstract>\n  <identifier type=\"local\">1999.1001 PER</identifier>\n  <subject>\n    <geographic>The Vogue Theatre, Vancouver, BC</geographic>\n  </subject>\n  <subject>\n    <topic>Cree First Nations Arts and Culture</topic>\n  </subject>\n  <subject>\n    <topic>Drumming</topic>\n  </subject>\n  <subject>\n    <topic>Vocal Music</topic>\n  </subject>\n  <subject>\n    <topic>Cabaret</topic>\n  </subject>\n  <subject>\n    <topic>Performance Art</topic>\n  </subject>\n  <name type=\"personal\">\n    <namePart type=\"given\">Anthony</namePart>\n      <namePart type=\"family\">McNab Favel</namePart>\n        <role>\n    <roleTerm authority=\"marcrelator\">Performer</roleTerm>\n  </role>\n  \n   \n</name>\n  <physicalDescription>\n\t\t\t\t\t</physicalDescription>\n  <originInfo>\n    \t<dateIssued keyDate=\"yes\">1999-10-01</dateIssued>\n    \t<publisher>grunt gallery</publisher>\n    \t</originInfo>\n  <genre authority=\"aat\">music</genre>\n  <accessCondition type=\"use and reproduction\">Copyright grunt gallery 2020. For more information, researcher inquiries, or takedown requests please contact grunt's archives manager dan@grunt.ca</accessCondition>\n  <accessCondition type=\"use and reproduction\" displayLabel=\"Rights Statement\">http://rightsstatements.org/vocab/InC/1.0/</accessCondition>\n</mods>\n\n","children":["/Volumes/Arca/Grunt/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret/1999_10_01_LIVE_Biennial_Live_at_the_End_of_the_Century_Performance_Art_Cabaret_Anthony_McNab_Favel_negative_15_retouched-2.tif","/Volumes/Arca/Grunt/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret/1999_10_01_LIVE_Biennial_Live_at_the_End_of_the_Century_Performance_Art_Cabaret_Anthony_McNab_Favel_negative_16_retouched-3.tif","/Volumes/Arca/Grunt/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret/1999_10_01_LIVE_Biennial_Live_at_the_End_of_the_Century_Performance_Art_Cabaret_Anthony_McNab_Favel_print_01_retouched-4.tif","/Volumes/Arca/Grunt/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret/1999_10_07_LIVE_Biennial_Live_at_the_End_of_the_Century_Anthony_McNab_Favel_Performance_Art_Cabaret_Arca_remote_media-1.txt"],"record_id":"1","no_datastreams_setting_flag":true,"cpd_item_info":"[object] (stdClass: {\"key\":\"1\",\"child\":\"\",\"directory\":\"Anthony_McNab_Favel_Performance_Art_Cabaret\",\"Title\":\"Anthony McNab Favel Performance Art Cabaret\",\"Subtitle\":\"\",\"Creator1_Given\":\"Anthony\",\"Creator1_Family\":\"McNab Favel\",\"Creator1_Role\":\"Performer\",\"Creator1_Alt_Name\":\"\",\"Creator1_Alt_Name_Type\":\"\",\"Creator2_Given\":\"\",\"Creator2_Family\":\"\",\"Creator2_Role\":\"\",\"Creator2_Alt_Name\":\"\",\"Creator2_Alt_Name_Type\":\"\",\"Creator3_Given\":\"\",\"Creator3_Family\":\"\",\"Creator3_Role\":\"\",\"Creator3_Alt_Name\":\"\",\"Creator3_Alt_Name_Type\":\"\",\"Creator4_Given\":\"\",\"Creator4_Family\":\"\",\"Creator4_Role\":\"\",\"CorporateCreator\":\"\",\"CorporateDonor\":\"\",\"Publisher\":\"grunt gallery\",\"Publisher_Place\":\"\",\"Date_Issued\":\"1999-10-01\",\"Date_Qualifier\":\"\",\"Extent\":\"\",\"Subject1_Topic\":\"Cree First Nations Arts and Culture\",\"Subject2_Topic\":\"Drumming\",\"Subject3_Topic\":\"Vocal Music\",\"Subject4_Topic\":\"Cabaret\",\"Subject5_Topic\":\"Performance Art\",\"Subject6_Topic\":\"\",\"Subject1_Geographic\":\"The Vogue Theatre, Vancouver, BC\",\"Subject2_Geographic\":\"\",\"Continent\":\"\",\"Country\":\"\",\"Region\":\"\",\"State\":\"\",\"Territory\":\"\",\"County\":\"\",\"City\":\"\",\"citySection\":\"\",\"Island\":\"\",\"Area\":\"\",\"extraterrestrialArea\":\"\",\"Coordinates\":\"\",\"Subject1_Given\":\"\",\"Subject1_Family\":\"\",\"Subject1_Title\":\"\",\"Subject2_Given\":\"\",\"Subject2_Family\":\"\",\"Subject2_Title\":\"\",\"Subject3_Given\":\"\",\"Subject3_Family\":\"\",\"Genre\":\"music\",\"Genre_Authority\":\"aat\",\"Type\":\"\",\"Form\":\"\",\"internetMediaType\":\"\",\"Description\":\"Anthony McNab Favel's piece in the Performance Art Cabaret.\",\"Language\":\"\",\"Physical_Description\":\"\",\"Notes\":\"\",\"LocalIdentifier\":\"1999.1001 PER\",\"AccessIdentifier\":\"\",\"URI\":\"\",\"ISBN\":\"\",\"DOI\":\"\",\"Classification\":\"\",\"PhysicalLocation\":\"LIVE at the End of the Century Binder 1, grunt gallery archives\",\"Rights\":\"Copyright grunt gallery 2020. For more information, researcher inquiries, or takedown requests please contact grunt's archives manager dan@grunt.ca\",\"CreativeCommons_URI\":\"\",\"RightsStatement\":\"http://rightsstatements.org/vocab/InC/1.0/\"})","MODS_expected":false,"cpd_input_dir":"/Volumes/Arca/Grunt/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret","cpd_output_dir":"/Volumes/Arca/Grunt/Output/Cabaret/compound/Anthony_McNab_Favel_Performance_Art_Cabaret"},"severity":2,"file":"/Users/brandon/sfuvault/mik/src/writers/CsvCompound.php","line":141} []

This is because the target directory doesn't exist, and MIK fails to bother creating it.

A mkdir in the writer, just like the other writers, should fix it.

Side note: there are so many repeated tasks in the writers, as well as fetchers, etc. Should we not turn these into global functions so that they can be referenced, used, and updated as needed without this kind of inconsistency?

mjordan commented 4 years ago

@bondjimbond the place for these shared functions is in the Writer abstract class, https://github.com/MarcusBarnes/mik/blob/master/src/writers/Writer.php.