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

Add --clear_temp parameter #447

Closed bondjimbond closed 6 years ago

bondjimbond commented 6 years ago

In cases where you're running MIK multiple times (right now I'm working on processing the same INI file with minor changes for several different directories), you need to clear the temp directory every time to get rid of the .metadata files or else the process doesn't work.

It would be nice to have a --clear_temp parameter that automatically empties the temp directory so that the next run can commence immediately.

mjordan commented 6 years ago

There's a shutdown script to do that, https://github.com/MarcusBarnes/mik/blob/master/extras/scripts/shutdownhooks/delete_temp_files.php. To use it, add this to your .ini file:

[WRITER]
shutdownhooks[] = "php extras/scripts/shutdownhooks/delete_temp_files.php"

This is documented under the "Shutdown scripts" section of the wiki, but it would be useful to have a cookbook entry filed under "Working with Metadata". Any other suggestions for where it would be findable on the wiki?

bondjimbond commented 6 years ago

Ack, thanks. Thinking back now, I'm pretty sure I had asked for that in the past and you suggested writing a shutdown hook to do it. Poor memory I guess. But it's nice to have it get more exposure in the wiki. Cookbook entry is a good idea... I can't think of any other spots offhand.

mjordan commented 6 years ago

@bondjimbond @MarcusBarnes Take a look?

https://github.com/MarcusBarnes/mik/wiki/Cookbook:-Keeping-your-metadata-cache-clear-during-testing

bondjimbond commented 6 years ago

Thanks, @mjordan

Does this function simply clear out the entire temp directory, or just the .metadata files?

MarcusBarnes commented 6 years ago

@bondjimbond It will clear out the entire temp directory. This can be seen in this block of code in the shutdown script: https://github.com/MarcusBarnes/mik/blob/master/extras/scripts/shutdownhooks/delete_temp_files.php#L14-L18.

@mjordan The wiki page on clearing metadata cache looks good. Thanks.

mjordan commented 6 years ago

Thanks @MarcusBarnes .

Filegetters and some manipulators store stuff in the temp directory, so their files would be removed as well. That should probably be added to the cookbook entry. But, whether or not those files are there should be transparent to the user, except for a potential decrease in speed.