Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Migrate session limit configuration from Drupal 7 site to Drupal 9 site.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#11 | interdiff_8-11.txt | 5.04 KB | srishtiiee |
#11 | session_limit_migration_3253469-11.patch | 23.91 KB | srishtiiee |
#8 | interdiff_5-8.txt | 22.01 KB | srishtiiee |
#8 | session_limit_migration_3253469-8.patch | 24.2 KB | srishtiiee |
#5 | session_limit_migration_3253469-5.patch | 6.79 KB | srishtiiee |
Comments
Comment #2
srishtiiee CreditAttribution: srishtiiee at Acquia commentedComment #3
srishtiiee CreditAttribution: srishtiiee at Acquia commentedComment #5
srishtiiee CreditAttribution: srishtiiee at Acquia commentedChanged test name.
Comment #7
Wim LeersIs there no equivalent D7 configuration for
session_limit_masquerade_ignore
andsession_limit_roles
config in the D9 port? 🤔/me checks:
session_limit_masquerade_ignore
→ https://git.drupalcode.org/project/session_limit/-/blob/7.x-2.3/session_...session_limit_roles
→session_limit_rid_*
→ https://git.drupalcode.org/project/session_limit/-/blob/7.x-2.3/session_...So marking
for those. Note that the latter means this migration will need an optional dependency ond7_user_role
.Comment #8
srishtiiee CreditAttribution: srishtiiee at Acquia commentedComment #9
srishtiiee CreditAttribution: srishtiiee at Acquia commentedComment #10
Wim LeersThe test does not get executed or even found by DrupalCI. Why? 🤔
Aha, this namespace does not match the directory structure, I think that's why!
This makes it seem like it's processing/transforming all/arbitrary session limit (user) config.
But it's not.
It's only for
session_limit_roles
.So let's call this something like
session_limit_rid_variables_to_roles_array
— more detailed, more specific, but that's also exactly what it does :)Copy/paste remnant 🤓😅
$rid
is an array, not a role ID like its name suggests.[,,$rid] = explode(…);
would be simpler.
See https://3v4l.org/86BMi
I'm a bit confused by this.
The
$configuration['variables'] = …
explicitly loads 5 variables.But then in
::prepareRow()
for every one of these 5 variables, it seems to perform a DB query against thevariable
table and overrides what's in the row.I think we should try to generate a unique row and then do the necessary processing only on that one row.
Can you check how many times the DB query in
::prepareRow()
is executed? I suspect it gets executed 5 times, once for each of the 5 variables listed in$configuration['variables'] = …
.Let's pair on figuring out a better way for this.
Comment #11
srishtiiee CreditAttribution: srishtiiee at Acquia commentedAddressed all issues in #10.
Pt.5-
prepareRow()
gets called only once and adds variables related to user roles by querying the variable table along with the variables listed in$configuration['variables'] = …
Comment #12
Wim LeersRE: point 5: ahhhh, you're right! I'd forgotten! You can see this in
\Drupal\migrate_drupal\Plugin\migrate\source\Variable::doCount()
: it always returns count1
! 👍I have only nits, which can be addressed upon commit by the maintainer:
Nit: We should make this a
required
dependency; without the roles existing, we can't do a lookup.It will work correctly without this change though, because essentially every site will execute
d7_user_role
. Still, better to be more precise.s/SessionLimit/SessionLimitRidVariablesToRolesArray/
Nit: The comment must always be a single line. And we can't both "inherit doc" and write docs.
So … let's move this into the method. 🤓