Batched view always appends to export file

Created on 12 October 2022, about 3 years ago
Updated 26 May 2023, over 2 years ago

Problem/Motivation

I have a data export view setup using the batch method (size 200). When I run $ drush vde on the view it always appends to the same file instead of replacing it. I have a crontab entry setup to run this drush command once per day.

If for example, my view returns 500 items, the first cron run will result in 501 rows in the output CSV file (1 row for header). The second cron run will result in 1001 rows, then 1501, etc...

You can see here that for batch jobs the file gets written with file_put_contents() which is always set to FILE_APPEND - https://git.drupalcode.org/project/vde_drush/-/blob/2.0.x/src/FormatManipulatorDefault.php#L48 I need to omit this third parameter if it's a new batch job so the file gets overwritten.

Steps to reproduce

Create a data export view, in export settings set the method to batch. Run $ drush vde on the view to export the file to a location. Run the same command again to see the file has duplicate data.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

🇨🇦Canada smulvih2 Canada 🍁

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024