Admin Menu, Multiple Developers and a Shared Database

Profile picture

I'm a big fan of the Admin Menu module. I'm also a big fan our multiple developer development process.

If you're using these two things together (admin menu & shared database) you've probably the problem this will fix. Admin menu caches it's links. That means that if we are sharing a database and separate URL space, admin menu will link to the wrong sandbox. (pointing to /~otheruser/ instead of /~myuser/)

The trick is to prefix your cache tables. In your settings.php after $db_url, define $db_prefix as (with your username instead of

<?php
$db_prefix
= array(
  
'cache' => 'jskulski_',
  
'cache_admin_menu' => 'jskulski_',
  
'cache_menu' => 'jskulski_',
);
?>

Then create cache tables in MySQL with commands like:

CREATE TABLE jskulski_cache LIKE cache;
CREATE TABLE jskulski_cache_admin_menu LIKE cache_admin_menu;
CREATE TABLE jskulski_cache_menu LIKE cache_menu;

This will copy the structure of cache and create the jskulski_cache table. Clear caches and you will enjoy admin_menu immunity!

You can read the Admin Menu issue dealing with this problem.

Add comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br/> <br /> <p> <img> <blockquote> <i> <b> <u>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.

Client Testimonial

We have found Chapter Three to be a valuable resource in both training and development of custom Drupal functionality. In addition, getting Chapter Three’s help with scaling Drupal has been a real asset.

Jim Nisbet, CTO Highwire Press

Drupalcon SF 2010