The domain id is now based on the hostname, which is not unique in all cases (for instance when using country_path):

public function createDomainId() {
    // We cannot reliably use sequences (1, 2, 3) because those can be different
    // across environments. Instead, we use the crc32 hash function to create a
    // unique numeric id for each domain. In some systems (Windows?) we have
    // reports of crc32 returning a negative number. Issue #2794047.
    $this->domain_id = abs((int) crc32($this->getHostname()));
  }

It should be based on id.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jurcello created an issue. See original summary.

jurcello’s picture

I would personally use the id because that needs to be unique anyway.
Patch added.

jurcello’s picture

Status: Active » Needs review
jurcello’s picture

jurcello’s picture

Also added an update hook in order to be able to update existing installations.

jurcello’s picture

Forget about the last patch: since the module is in alpha, the update hook is not needed.

agentrickard’s picture

My comments are in the PR. I think the update is warranted for people using the module in production, but I'd like to see if we can make it fire only if needed.

Perhaps check the domain_id against both methods and update if it isn't using id as a seed?

agentrickard’s picture

FileSize
3.06 KB

Here's the patch version of PR 300.

https://github.com/agentrickard/domain/pull/300

agentrickard’s picture

Status: Needs review » Fixed

This has been committed, but only to GitHub for the moment.

It will be in alpha 7.

  • agentrickard committed fc98105 on 8.x-1.x
    Issue #2833053 by @jurcello. Better unique id handling.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.