- Issue created by @libbna
- Assigned to libbna
- Issue was unassigned.
- Status changed to Needs review
almost 2 years ago 8:42am 15 March 2023 - Status changed to Closed: works as designed
over 1 year ago 7:58pm 3 August 2023 - 🇺🇸United States tr Cascadia
This code appears in an update hook.
Update hooks should not be changed, for many reasons but primarily because if two different sites are updated using different code in the "same" update hook, then we have no way of ensuring that those two sites end up in the state, and if there is a problem with one of the hooks we have no way to tell which sites ran the problem hook and which sites didn't. It is ALWAYS better to create a new update hook to fix any problems in a previous update hook, rather than to re-write a previous update hook.
It is entirely valid for update hooks to contain code that is deprecated or even invalid in the latest version of Drupal core, because update hooks are used to update the contributed module between specific versions. Update hooks will never be run on new installs of the contributed module.
In this case, the update hook in question was committed back in 2020, three years ago, before Drupal 9.2 existed, and a year before the usage in this hook was deprecated. When updating a site to a new version of Drupal the process is:
1) First update the contributed modules to their most recent version.
2) Update core.
If the site upgrade is done properly, the update hooks will be run before core is updated, which means that things that are deprecated in the new version of core STILL WORK when the update hooks are run.While it is not technically wrong to add the accessCheck() to the update hook after the fact, I would rather the update hook fail because this update hook should NEVER run under Drupal 10. If it does run, then you have a problem on your site and this will stop you from proceeding further rather than working and letting you dig a bigger hole for yourself.
BTW, I changed the status to "Task" because, as a deprecation introduced AFTER this module's code was written, it is not a "Bug", it is simply something that might need to be addressed eventually in the future. Nothing is broken by a deprecation, everything still works until the next major release. And deprecations are routine matters, not "Major".