Problem/Motivation
The current ContentPurger does not purge all the content because access check is enabled (access check is enabled per default).
Also since Drupal 9.2.0: Access checking must be explicitly specified on content entity queries
Steps to reproduce
- Add some access checks on a content type (cf. hook_query_TAG_alter etc...)
- Run
drush content-fixtures:purge
Proposed resolution
Disable the access check.
Remaining tasks
Add tests.
User interface changes
None.
API changes
None.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | disable-access-check-to-purge-all-contents-3249921-2.patch | 535 bytes | beram |
Comments
Comment #2
beram commentedHere's the patch.
I will tried to add tests soon.
Comment #3
luke_nuke commentedThanks for letting me know beram. But doesn't this access check only enable grant system? It looks like that's the case by looking at the "node_query_node_access_alter()" function, so hook_node_access and such actually shouldn't be affected, and I wasn't able to reproduce the issue with them. Are you sure that the issue can be invoked in these hooks? If that's just a matter of grants, we can close it quickly as I already prepared proper test for grants during my investigation, and we could use it with your patch, but I need confirmation if referenced "hook_node_access" was really affected for you or was it just a mistake in report.
Comment #4
beram commentedFor nodes the access check is based on grants yes, it is a mistake you are right! I did not read what I have written quickly. Summary has been fixed!
The issued I had was not about nodes but another content entity to be honest. The result is same though.
Also I noticed I forgot to add in the summary that since Drupal 9.2.0: Access checking must be explicitly specified on content entity queries
Sorry for the poor issue report!
Comment #6
luke_nuke commentedFix has been committed and supplemented with tests. New release is also up! Note that the new release version is 3.0.0 because I decided to finally switch to semantic versioning. Thank you for your help!