Closed (fixed)
Project:
Group
Version:
2.0.0
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
19 Apr 2023 at 07:07 UTC
Updated:
7 Jun 2023 at 12:19 UTC
Jump to comment: Most recent, Most recent file
With current update path from 8.x-1.5 to 2.0.0 you need to use 2 steps to upgrade from 8.x-1.x to 2.0.x which is already mentioned in release notes of 2.0.0 release.
For people who already use a composer workflow to manage their group related Drupal projects this upgrade process could be improved very simple by adding an extra hook_update_N() as first update hook to group 2.0.x module.
drush updb command to trigger all group 2.0.0 related updates without previously enabling flexible_permissions module.The website encountered an unexpected error. Please try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "group_permission.calculator" has a dependency on a non-existent service "flexible_permissions.chain_calculator". in Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass->processValue() (line 86 of /home/public_html/staging/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php).
Add following hook_update_N() to group.install file:
/**
* Install required flexible_permissions contrib module.
*/
function group_update_9200() {
\Drupal::service('module_installer')->install(['flexible_permissions'], TRUE);
}
Check if this also work for people who do not use composer workflow to manage their Drupal group related projects.
No user interface changes.
No API changes.
No data model changes.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | group-improve_upgrade_path_from_1_5_to_2_0_0-3355034-3.patch | 459 bytes | it-cru |
Comments
Comment #2
it-cruComment #3
it-cruComment #4
it-cruComment #5
kristiaanvandeneyndeOut of curiosity, what would happen if you run this update hook without having flexible_permissions in your code base. A quick glance at ModuleInstaller does not seem to show any code checking whether the module is actually there. Trying to make sure non-Composer workflows don't get even more problems if I were to commit this patch.
Comment #6
it-cru@kristiaanvandeneynde I will try to test manual update process together with my patch without downloaded flexible_permissions module tomorrow morning on my way to office or in the evening on my way back to home and give here some feedback. I think currently it will throw some exception error from module_installer service.
Comment #7
kristiaanvandeneyndeCool, thanks!
Comment #8
markdcApplied the patch and ran composer update. flexible_permissions is not downloaded as a dependency.
Ran
drush updband got this as IT-Cru expected:Comment #9
it-cruResults of my tests with my added update hook group_update_9200().
1. Upgrade test - Manual downloaded group without flexible_permissions module
Here I only downloaded group module 2.0.0 from d.o and replaced existing 8.x-1.5 one WITHOUT manual downloading of flexible_permissions module.
This results in a broken website with following error, but not from my update hook because of previous internal dependency checks.
2. Upgrade test - Manual downloaded group and flexible_permissions modules
Here I downloaded group 2.0.0 from d.o and replaced existing 8.x-1.5 one and manual downloaded flexible_permissions 1.0.0 module.
3. Upgrade test - Update group module via composer
Here I change my group entry in composer.json from
"drupal/group": "^1.0"to"drupal/group": "^1.0 || ^2.0".And than I run drush updb command without any issues.
@kristiaanvandeneynde: So with my update hook upgrade is only broken, when flexible_permissions module wasn't downloaded by developer / site builder/maintainer. When it was manual or via composer downloaded flexible_permissions module gets enabled during upgrade.
@markdc: Which exact composer update command do you use, that dependency of drupal/flexible_permissions module wasn't resolved by composer itself and how your drupal/group entry in composer.json was set?
Comment #10
heddnI just tested this as well with a 2.x upgrade. Adding this as the first module to enable gives us access to it in later updates and during a final cache clear. I tested using
drush deployand usingdrush updbComment #11
tomefa commentedTest the patch also and the drush updb work as expected to the end.
But still when accessing the Website or running drush cr, this error appear:
The service "group_permission.checker" has a dependency on a non-existent service "group_permission.chain_calculator". Did you mean one of these: "flexible_permissions.chain_calculator", "group_permission.hash_generator", "group_permission.calculator", "group_permission.individual_calculator", "group_permission.synchronized_calculator"?Comment #12
it-cru@Tomefa: When I see it right in group.services.yml file this seems to be from 8.x-1.x services definitions. Are all your instances have new code base from group 2.0.x or 3.0.x?
Comment #13
tomefa commented@it-cru: checked the file and it's group 2.0.1 that i used.
But still the same error message, the problem appear on drush cr also. Probably the database have still the information of the old entries for this services and cannot be update.
Comment #14
it-cru@Tomefa: Sounds a little bit like this. In my test cases cache_discovery was managed via Drupal's chainedfast caching backend and was stored in APCu and Memcached.
Comment #15
tomefa commentedActually, i was using the module Group outsider in that decorate the group_permission.checker with the problematic "group_permission.chain_calculator" service.
With group 2.x, this extra module is not anymore necessary (see ticket https://www.drupal.org/project/group/issues/2884662).
Solution was to uninstall this extra module in a hook update, and now with this patch, it is working as expected.
Comment #17
kristiaanvandeneyndePushed, will release alongside at least one extra bugfix as to keep the version numbers in sync with 3.0.x, which did not get this patch for obvious reasons.