Admin Menu, Multiple Developers and a Shared Database

0

October 29, 2009 - 3:17am

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

<span style="color: #000000"><span style="color: #0000BB"><?php<br />$db_prefix </span><span style="color: #007700">= array(<br />   </span><span style="color: #DD0000">'cache' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'jskulski_'</span><span style="color: #007700">,<br />   </span><span style="color: #DD0000">'cache_admin_menu' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'jskulski_'</span><span style="color: #007700">,<br />   </span><span style="color: #DD0000">'cache_menu' </span><span style="color: #007700">=> </span><span style="color: #DD0000">'jskulski_'</span><span style="color: #007700">,<br />);<br /></span><span style="color: #0000BB">?></span></span>

Then create cache tables in MySQL with commands like:

CREATE TABLE jskulski_cache LIKE cache;<br />CREATE TABLE jskulski_cache_admin_menu LIKE cache_admin_menu;<br />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.

Comments

Post a comment

To prevent automated spam submissions leave this field empty.
CAPTCHA
Let us know you're human by typing in this code. The code is case sensitive.
Image CAPTCHA
Enter the characters shown in the image.