MukurtuCMS / mukurtucms

GNU General Public License v2.0
81 stars 36 forks source link

Cleanup of batch_export and mukurtu_batch_import files. #141

Closed kenianbei closed 2 years ago

kenianbei commented 2 years ago

I've just taken over a Mukurtu 2 project, and there are about 5GB of zip files in the sites/files/default/private/batch_export & mukurtu_batch_import directories. Is this intended behavior? Are these files needed after import/export operations are finished? If not, seems like adding a hook_cron to clean up files would be useful. I can submit a PR is this is the case...

taylor-steve commented 2 years ago

I'd have to look at it but I'm guessing either cron isn't running or we incorrectly flagged the uploaded files as permanent rather than temporary. It's not intended behavior. If you want submit a PR (against develop, ideally) we'll do our best to get it in. Mukurtu v2/v3 is on a critical security updates schedule only as we focus on the Drupal 8+ version, so I'm not sure when we'd roll it into a general release. Thanks!

kenianbei commented 2 years ago

I checked the database, it's a permanent file. Looking at the module code, it looks like the file_save_data() call in csv.inc defaults to creating a permanent file during export. You'd have to resave the file afterwards with $file->status = FILE_STATUS_TEMPORARY. Probably enough of an edge-case to not worry about, particularly with people moving to D9. I will just clean them up manually now that I'm sure they are only used for one-time export.