Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSV exporter might fail if the CID used by the temporary storage surpasses the max DB length for the name #177

Closed
DiegoPino opened this issue Jul 26, 2023 · 1 comment
Assignees
Labels
bug Something isn't working CSV Processing Things we do here and there to keep the tabulated goddesses happy Find and Replace VBO Actions I got my head out the sunroof
Milestone

Comments

@DiegoPino
Copy link
Member

DiegoPino commented Jul 26, 2023

What?

Unheard of before. But I should have known better bc I saw something (and fixed) similar while building the LoD reconciliation service.

During an CSV export, to keep the order of children/parents in place we generate a Batch that uses temporary storage. Temporary storage requires a unique ID per item, and that one (to avoid overlaps while multiple users export at the same time or a single user does the same) is generated using a combination of the Views, the Display ID, etc

See:

$this->context['sandbox']['cid_prefix'] = $this->context['view_id'] . ':'
. $this->context['display_id'] . ':' . $this->context['action_id'] . ':'
. md5(serialize(array_keys($this->context['list']))) . ':';

This name, when the Views Machine name + the Display name are very long (happened to me, I promise) will fail badly at the DB level!
(gosh drupal) giving you a truly scary exception 👻

Solution is to reduce the whole thing to an md5() and done.

@DiegoPino DiegoPino added bug Something isn't working Find and Replace VBO Actions I got my head out the sunroof CSV Processing Things we do here and there to keep the tabulated goddesses happy labels Jul 26, 2023
@DiegoPino DiegoPino added this to the 0.5.1 milestone Jul 26, 2023
@DiegoPino DiegoPino self-assigned this Jul 26, 2023
@DiegoPino DiegoPino changed the title CASV exporter might fail if the CID used by the temporary storage surpasses the max. DB length CSV exporter might fail if the CID used by the temporary storage surpasses the max DB length for the name Jul 26, 2023
@DiegoPino
Copy link
Member Author

Solved via cdf77a6 but I will have to go the long and pailful road of making an issue/pull at drupal for this one
https://git.drupalcode.org/project/views_bulk_operations/-/blob/4.2.x/src/ViewsBulkOperationsBatch.php#L76

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CSV Processing Things we do here and there to keep the tabulated goddesses happy Find and Replace VBO Actions I got my head out the sunroof
Projects
None yet
Development

No branches or pull requests

1 participant