Regenerations cannot be scripted to run during drush updb

Created on 29 January 2020, about 5 years ago
Updated 8 May 2023, almost 2 years ago

We use update hooks to run things on deployments in a variety of environments. I wanted to write an update hook to automatically regenerate my XML sitemaps. So I copied what's in xmlsitemap_rebuild_form_submit(), calling xmlsitemap_rebuild_batch() to get a batch which I can then call batch_set() on.

Whilst this is fine when running via update.php, it won't work under Drush (version 8 at least), because Drush uses an object (one that implements ArrayAccess, I believe) to handle batches set during updates and some of the operations explicitly specify array in their type-hints.

I do notice that a few of the other batch operations around the XML sitemap project do not have this type-hint, plus other projects have gone about removing them because of this issue (e.g. #2689939: Remove array typehints from batch callbacks, fix Drush commands β†’ & #2664290: Remove array typehints from batch callbacks β†’ ).

Patch to follow :-)

πŸ› Bug report
Status

Fixed

Version

2.0

Component

xmlsitemap.module

Created by

πŸ‡¬πŸ‡§United Kingdom james.williams

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