woocommerce / woocommerce-subscriptions-importer-exporter

Import your subscribers to WooCommerce from a CSV. Or export your subscription data from WooCommerce to CSV.
GNU General Public License v3.0
148 stars 56 forks source link

Remove imported and exported files automatically after they've been used #219

Closed mattallan closed 4 years ago

mattallan commented 4 years ago

66f2409 - Deletes the imported files 2 days after they were created.

The reason for deleting them after 2 days is because some imports can be big and slow enough to go over a day (I recall Brents computer staying awake for ages while doing an import)

c4b502e - Deletes exported files that are exported via Cron and stored in /uploads/ Brent mentioned it would be nice to not rely on the plugin being active in order for these to be deleted but since there's no file_id stored for these in the DB we can't use the importer_scheduled_cleanup method for exported files.

@menakas can you please review this one 😄

I think this is a good baseline. Some other things we can look at:

Thanks

mattallan commented 4 years ago

Why was the timestamp introduced to the filename?

Good question! I actually removed this as well when I first looked at this and then realised it was being used to fill in the date column in the list of exported files.

Displaying this data is helpful if you export multiple times a day and want to know which is the latest export.

With that in mind, I've updated the code to remove the timestamp from the filename and I'm now filling in the date column using the files created time see d039054.

Also the exported filename is now filename-hash(time . filename).csv see caae26a :+1:

Let me know what you think of the latest changes and we'll tag a release once this is merged.

Thanks for the review

menakas commented 4 years ago

@mattallan LGTM. Merging...