Problem/Motivation

If the taxonomy_access_fix_update_9401 and taxonomy_access_fix_update_9402 hooks run in the same deploy as the user_update_10000 hook (e.g. during a site update from Drupal 9 to 10), the deploy can fail. This is because the taxonomy_access_fix update hooks change the permissions and save the roles, which causes an error if the role contains non-existent permissions:

Adding non-existent permissions to a role is not allowed.

Proposed resolution

Implement taxonomy_access_fix_update_dependencies to indicate that the taxonomy_access_fix update hooks have to run after the user update hook.

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

DieterHolvoet created an issue. See original summary.

dieterholvoet’s picture

Status: Active » Needs review
feyp’s picture

Status: Needs review » Needs work

Thanks for filing the issue.

The assumption was that you made the update of the module before upgrading core, a direct upgrade of both at the same time has never been tested.

Looking at the test results, it looks like this is failing, if you do the update in Drupal 9. I guess because then the dependencies are not fulfilled, because there is no such user update hook, yet?

Looks like we need to work on this some more.

feyp’s picture

Priority: Normal » Major

For now, I've added this as a known issue to the release notes. I'd also say this is a major issue.

feyp’s picture

dieterholvoet’s picture

I added a workaround that should fix this issue. However, the test failure looks like a core bug, so I'll file an issue in that issue queue.

dieterholvoet’s picture

Status: Needs work » Needs review
feyp’s picture

Thanks! Test results look good now and the code looks good as well. I didn't realize that the fix would be that easy, I thought we might have to move everything to post update hooks, which might have had other problems, or work on the role config directly or something...

I'd like to give this some manual testing before I commit this, just in case, will do that later. Then I can hopefully also take a look at the MR for core, unless @smustgrave beats me to it ;).

feyp’s picture

Status: Needs review » Reviewed & tested by the community

Now had a chance to test the various upgrade paths manually and it seems to work as intended. RTBC.

  • FeyP committed 3ea733c9 on 4.x authored by DieterHolvoet
    Issue #3376410 by DieterHolvoet, FeyP: The 9401 and 9402 update hooks...
feyp’s picture

Status: Reviewed & tested by the community » Fixed

Merged. Thanks again!

Status: Fixed » Closed (fixed)

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