Closed renatonascalves closed 5 months ago
You're saying rather than having the source data come from the WP database, have it come from a CSV file?
Correct. As an option.
I currently have a few CLI commands that accept a CSV file, and perform migrations to the rows and noticed we are losing a lot of the goodies from this library. Besides forcing one to duplicate a lot of functionality.
I'm thinking of something similar to this: https://github.com/alleyinteractive/wp-bulk-task/blob/193f03008a17ce5609798be5b4b8eaf073f85bbd/src/class-bulk-task.php#L236
A custom one that handles CSV rows.
That makes sense, and then the callback, instead of passing a WP_Post object, passes in the row extracted from the CSV, and implementers are responsible for doing what they want with that row. Good suggestion!
Exactly!
Description
Imagine creating a CLI command to perform migrations from a CSV file into a site. Currently, the bulk task does't support this scenario.
Ideally, the
run
method accepts an optional$object_type
argument. Whencsv
is supplied as the arg. The first argument would also accept a CSV file, with its params.Use Case
A CLI command to perform migrations from a CSV file into a site. The CLI will benefit from all the benefits of the
Bulk_Task
task.