Right now, admin_menu_output() uses the following pattern to generate a unique $cid string:

  $cid = 'admin_menu:' . $user->uid . ':' . session_id() . ':' . $language->language;

But there are instances in which a user may have differing sets of administrative options even within the same session. With Domain Access, for example, a user could have content publishing options that change from domain to domain. It would be nice if modules could add to the $cid pattern in this kind of instance.

Files: 
CommentFileSizeAuthor
#3 admin_menu-cache_cid_alter-1635956-3.patch2.36 KBMrHaroldA
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Comments

Les Lim’s picture

Status: Active » Needs review
FileSize
1.3 KB
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Patch attached.

MrHaroldA’s picture

Assigned: Unassigned » MrHaroldA
Issue summary: View changes
Status: Needs review » Needs work

The proposed solution does not work: the $cid is created in at least 2 places, and the call to domain_get_domain() will result in fatal errors on sites without the Domain Access module enabled.

I'll try to create a working patch today. Or something like that ;)

MrHaroldA’s picture

Status: Needs work » Needs review
FileSize
2.36 KB
PASSED: [[SimpleTest]]: [MySQL] 228 pass(es). View

Here ya go!

I've recreated the patch above; this time with no direct Domains support, as that is a task for the Domain Access module, or you can implement the following code yourself:

/**
 * Implements hook_admin_menu_cache_cid_alter().
 */
function MY_MODULE_admin_menu_cache_cid_alter(&$cid) {
  $domain = domain_get_domain();
  $cid .= ':' . $domain['domain_id'];
}
Les Lim’s picture

Status: Needs review » Needs work

@MrHaroldA: That domain code was part of the api.php documentation file, as an example implementation of the new hook. I think the patch still needs some kind of example hook there.

MrHaroldA’s picture

Ah! That explains why the tests didn't fail ;)

Greg__’s picture

I tested the patch and it works for me.
I had the same issue with cache between domain so I did use the hook exemple in #3.
Thanks