I have a similar problem to the ones in the related issues:
Sitemaps generated with drush and cron (button and link) do not include published translated nodes when the default language node is unpublished.
When manually generating the sitemap via /admin/config/search/simplesitemap -> "Rebuild queue and generate" the translated nodes are included correctly.
I drilled it down to Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator->getDataSets() where the entityTypeManager query ($query->execute()) results in zero entities with drush and cron, and one entity when generating manually.
There are several nodes which disappear in the sitemap this way: each affected content type has only one node with several translations.
The nodes are accessible for anonymous user. Are drush and cron using a different context/user?
Setup: Drupal 8.8.1, PHP 7.2.26, Mysql 5.7.28
Comment | File | Size | Author |
---|---|---|---|
#3 | simple_sitemap_3102450.patch | 734 bytes | sleitner |
|
Comments
Comment #2
gbyte CreditAttribution: gbyte as a volunteer and commentedI tried to reproduce this in the past and failed in my environments. Can you please spin up a new Drupal instance and document a step-by-step reproducible way of getting this undesired result? I'll be happy to try and reproduce on my end and fix the bug. Alternatively if you can pinpoint the problem, feel free to submit a patch.
Comment #3
sleitner CreditAttribution: sleitner commentedIt turns out that access permissions are checked twice.
First implicitly in Drupal\simple_sitemap\Plugin\simple_sitemap\UrlGenerator\EntityUrlGenerator->getDataSets() when not specifying QueryInterface::accessCheck and second explicitly in Drupal\simple_sitemap\Plugin\simple_sitemap\EntityUrlGeneratorBase when checking $url_object->access .
This is a problem when you use a module which implements hook_node_access_records() and hook_node_grants() (e.g. node_view_permissions or node_view_language_permissions) in combination with drush or cron.
My suggestion is to not check the access in EntityUrlGenerator->getDataSets() and only check access in EntityUrlGeneratorBase
Comment #5
gbyte CreditAttribution: gbyte as a volunteer and commentedMust have been hard to catch, thanks! Feel free to reopen this issue if you have any further suggestions.