I am trying to get a upgrade path for Domain Taxonomy module: #1298226: Upgrade path from Domain Access 7.x-2.x to 7.x-3.x
While reviewing the changes, I noticed, what looked like the domain_id gets changed with this upgrade.
From what I saw, the default (primary?) domain in 2.x had a domain_id of 0. With 3.x, it grabs the next (new) domain_id and sets it, as well as sets the is_default to 1.
Domain Taxonomy (which I took over co-maintainership recently) refers to the "default domain_id". Could you please confirm that, in my upgrade implementation, I need to look for the domain_id where is_defaut = 1 to grab the default/primary domain's domain_id?
Also, could you please let me know, where in Domain Access 7.x-3.x should I look for these "data upgrade"? I checked the domain.install file but was unsure if the data upgrade was done there. It seems to be coded else where since the invocation happens after the install by user trigger on the modules admin page.
Thanks!
Comments
Comment #1
agentrickardThe data upgrade happens in a couple of places. Here are some clear answers. You might document your findings in the Handbook pages, too.
1) Modules like yours that need to update "zero records" should implement hook_update_N in the model shown by
domain_alias_update_7300anddomain_alias_update_dependencies().Note that you have to use a db_query here because we cannot guarantee that either module is enabled, due to how Drupal 7 runs its upgrade processes.
2) In your normal module code, you can use
domain_default_id()to get the value of the default domain (or usedomain_default()to get the entire array).3) The bit that happens on admin pages is a helper fail-safe in case some module developers don't implement step 1 correctly.
Note that your module can also leverage
domain_api_version()to determine if the site runs 7.x.3. You may need a new branch/release specifically tagged for 7.x.3 compatibility, or you can ensure that your code works with both versions.Comment #2
Vyoma commentedThis clarifies everything I need to know regarding default domain_id.
Now, I just need to work this into Domain Taxonomy module. :)
Thank you!
Update: And paint me dumb - I should have searched. Seems like it has been updated with details at the Handbook page: http://drupal.org/node/1120384
Comment #3
agentrickardHaha. I forgot that I wrote that page.