Hi everyone,
The original problem is as follows:
The hook_entity_base_field_info
which brings the metadata of the field authorization_drupal_roles_roles is deleted.
At the same time, the authorization_drupal_roles_update_8004()
method uses the following code to migrate the data :
$user = $user_storage->load($user_id);
$drupal_roles = $user->get(‘authorization_drupal_roles_roles’);
The $user->get('authorization_drupal_roles_roles')
cannot work properly because the metadata for the authorization_drupal_roles_roles field is no longer available due to the deletion of the hook_entity_base_field_info
. This causes the update to fail with the error 'Field authorization_drupal_roles_roles is unknown.'
@sunlix suggests re-adding the hook_entity_base_field_info
in order to play authorization_drupal_roles_update_8004()
.
This works for data migration. However, authorization_drupal_roles_update_8004()
uninstalls the storage of the authorization_drupal_roles_roles field so, at the end of the process, we have an inconsistency authorization_drupal_roles_roles field defintion:
- the field's metadata are present because the hook_entity_base_field_info
is present.
- the field storage no longer exists because the update authorization_drupal_roles_update_8004()
has deleted it.
To ensure that data migration works properly and that the authorization_drupal_roles_roles field is completely deleted, we propose to modify the way to retrieved original data in authorization_drupal_roles_update_8004()
: we use a "direct database query" instead of the user object loaded.
This isn't very conventional, but it seems to solve all the problems.
What do you think?
Aurélien.
Hi smustgrave,
Many thanks for your review !
Hi Vishal,
Many thanks for your help.
Hi Vishal,
Thank you for your quick feedback.
1. Fix phpcs issues.
All errors detected by phpsc are fixed.
2. FILE: event_log_track_encrypt.module
Description for a .module file is updated.
3. FILE: src/Commands/EventLogTrackDecryptCommands.php
Documentation comment for constructors is updated.
Please review.
Hi everyone,
After some thought, I think it's better to make a separate module rather than a sub-module of Events Log Track to support encryption.
Encryption feature brings new dependencies to the Encrypt and Key modules which are not useful for the majority of ELT users.
So I initialized the
Event Log Track Encrypt →
module instead of this Merge Request.
All comments and suggestions are welcome.
Best regards.
Aurélien.