This function can run multiple times on a page, so cache the results to avoid db load.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

agentrickard’s picture

Version: 7.x-3.x-dev » 6.x-2.x-dev
Status: Active » Needs review
FileSize
2.28 KB

Patch against 6--2. Note that we force refresh during node validation.

agentrickard’s picture

Status: Needs review » Fixed

Committed to 6.x.2, 7.x.2 and HEAD.

Status: Fixed » Closed (fixed)

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

gdud’s picture

Status: Closed (fixed) » Active
FileSize
1.33 KB

In some cases using static cache by domain_source_lookup() produces some wrong behaviour.

For example, when you are using CNR 6.x-4.1 module, after adding new node on domain X (X > 0) user is redirected to main domain (0).

I looked deeper in the codes of these two modules and I identified the problem:

domain_source_lookup() is execute twice during the node_save().

First by node_load() in corresponding_node_references_insert(). This leads to generate static cache using main domain (0) as value. This happen because proper value of domain source not save into {domain_source} table yet and default domain source is used.

When domain_source_lookup() is execute second time by Domain module to prepare node path, wrong value is given from static cache.

In my opinion, domain_source_lookup() should use static cache only for values fetched directly from database (not for default values).

In patch bellow is my modifications to domain_source_lookup().

agentrickard’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Active » Needs work

I can see the reasoning here. Needs to apply to 7.x.3 first.

agentrickard’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)