Closed bondjimbond closed 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?
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.
@bondjimbond @MarcusBarnes Take a look?
https://github.com/MarcusBarnes/mik/wiki/Cookbook:-Keeping-your-metadata-cache-clear-during-testing
Thanks, @mjordan
Does this function simply clear out the entire temp directory, or just the .metadata files?
@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.
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.
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.