Problem/Motivation

When running drush xmlsitemap-rebuild on a large site I get this error:

Undefined array key "node" xmlsitemap.generate.inc:500
WD php: TypeError: array_keys(): Argument #1 ($array) must be of type array, null given in array_keys() (line 500 of /var/www/site/docroot/profiles/recruiter/modules/xmlsitemap/xmlsitemap.generate.inc).#0
/var/www/site/docroot/profiles/recruiter/modules/xmlsitemap/xmlsitemap.generate.inc(500): array_keys(NULL)
#1 /var/www/site/docroot/includes/batch.inc(243): xmlsitemap_rebuild_batch_fetch('node', Array)

This probably happens because the count of nodes changed while the sitemap rebuild is running. Then there are no further nodes to process and we should stop.

Steps to reproduce

Run drush xmlsitemap-rebuild on a large site while nodes get deleted.

Proposed resolution

Check for empty results.

Remaining tasks

Merge request

User interface changes

none

API changes

none

Data model changes

none

Issue fork xmlsitemap-3528376

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

klausi created an issue. See original summary.

klausi’s picture

Status: Active » Needs review

merge request created.

gresko8’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch Klausi.