Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Attached is a patch for a drush command to bulk generate URL aliases using the batch API. It's not quite working yet, but I think it's close. The structure of the array that is passed to batch_set() matches the bulk alias form from (admin/build/path/update_bulk), and I'm calling batch_process(), but the process isn't getting kicked off. I need to get this done by this weekend if possible, so I'm hoping someone can help me bring this to the finish line.
Comment | File | Size | Author |
---|---|---|---|
#1 | pathauto-drush-batch-alias.patch | 3.63 KB | wonder95 |
pathauto-drush-batch-alias.patch | 4.03 KB | wonder95 | |
Comments
Comment #1
wonder95 CreditAttribution: wonder95 commentedAnd here it is without my commented out code borrowed from pathauto_bulk_update_form_submit().
Comment #2
wonder95 CreditAttribution: wonder95 commentedIt looks like the reason it isn't processing is that $batch['progressive'] is hardcoded to be TRUE (since I'm passing $batch in as an argument) in batch_process(), which then runs a drupal_goto(), which is a problem for drush, I would imagine. It looks like $batch['progressive'] needs to be set to FALSE so it can go to _batch_process() instead. However, even when I hack $batch['progressive'] = FALSE and that runs, I don't get any aliases re-generated in the url_alias table, although my CPU usage skyrockets.
Any suggestions as to how to address this?
Comment #3
Dave ReidI'm pretty sure the built-in drush batch commands have them run in a non-progressive manner.
Comment #4
wonder95 CreditAttribution: wonder95 commentedYeah, I had a major facepalm after I wrote that. I realized I don't need to go through any form functions at all.
Comment #5
xjmTracking.
Comment #6
Dave ReidGoing to merge this with #867578: Add drush commands for bulk alias updating/deleting