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.
When installing Domain Access a default site is created. It should have ID 0 because that is what determines it's the default site.
However if your MySQL is configured with auto_increment_offset it will break with the current code.
db_query("INSERT INTO {domain} (subdomain, sitename, scheme, valid) VALUES ('%s', '%s', '%s', %d)", $root, $site, $scheme, 1);
// MySQL won't let us insert row 0 into an autoincrement table.
// Similar to the {users} table, this leaves us with no row 1.
db_query("UPDATE {domain} SET domain_id = domain_id - 1");
This should not assume the domain_id
is 1. A better approach would be to have it force it to 0 instead of decreasing its current value with 1.
Do you agree? Then I can roll a patch for it.
Comment | File | Size | Author |
---|---|---|---|
#5 | 1407606-faulty-install-7-x-2.patch | 790 bytes | agentrickard |
#2 | Faulty-assumption-about-INSERT-index-1407606-2.patch | 981 bytes | tobiassjosten |
Comments
Comment #1
agentrickardThis is very similar to how core does it.
Do you not have the same problem with user 0?
See system_install().
If user module works for you, then the fix is likely this:
I suspect that the Drupal core code changed at some point, because this code was originally taken from system install.
Comment #2
tobiassjosten CreditAttribution: tobiassjosten commentedThat fix works perfectly and looks solid. Here's a patch as promised.
Comment #3
agentrickardThanks.
Note that this also applies to 7.x.2.
Comment #4
agentrickardWorks as expected. Committing to 6.x.
Comment #5
agentrickardAnd a committed patch for 7.x.2.
This issue does not affect 7.x.3.