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.

Comments

beram created an issue. See original summary.

beram’s picture

Here's the patch.

I will tried to add tests soon.

luke_nuke’s picture

Thanks 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.

beram’s picture

Issue summary: View changes

For 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!

  • Luke_Nuke committed adbca02 on 8.x-2.x authored by beram
    Issue #3249921 by beram, Luke_Nuke: Purge all content regardless the...
luke_nuke’s picture

Status: Active » Fixed

Fix 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!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.