As last step of installing site with custom installation profile I trying to rebuild xmlsitemap with xmlsitemap_rebuild_batch function. Everything work great but after adding some translation modules started appearing this error.
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: ../install.php?profile=fred&locale=en&id=2&op=do StatusText: Service unavailable (with message) ResponseText: Recoverable fatal error: Argument 1 passed to xmlsitemap_menu_xmlsitemap_process_menu_links() must be an array, null given, called in ../sites/all/modules/contrib/xmlsitemap/xmlsitemap.generate.inc on line 456 and defined in xmlsitemap_menu_xmlsitemap_process_menu_links() (line 83 of...
After debugging this functions I found the problem. In function xmlsitemap_rebuild_batch_fetch when the function is called at first time in batch variable $context['sandbox']['max'] is set to count of entities in DB in my case it was 515 entities. Checked it also manualy and the number was correct. But after few cycles of batch I checked it one more time and now there were only 514 entities. This leads to error becouse the ending conditions was always false and $info['xmlsitemap']['process callback']($ids); was called with NULL parameter. I don't know what is causing the difference in count of entities but this situation is possible so I made this patch to fix this situation.
| Comment | File | Size | Author |
|---|
Comments
Comment #1
reeller_sk commentedHere is the patch file.
Comment #2
Anonymous (not verified) commentedComment #4
Anonymous (not verified) commentedYou need to clone the git repository, checkout the 7.x-2.x branch, make your changes and then create the diff file.
Comment #5
reeller_sk commentedI'm sorry I didn't have time until now. So here is the patch based on 7.x-2.x branch. Added one more thing, after query execution i had case when result was empty so array_keys function caused warning parameter is not array.
Comment #6
Anonymous (not verified) commentedHere robot.
Comment #7
chris matthews commentedThe 6 year old patch in #5 to xmlsitemap.generate.inc does not apply to the latest xmlsitemap 7.x-2.x-dev and if still applicable needs a reroll.