Upgrades not updating properly!!! AAAAArrrrggggghhhh!!!!

Working on an import of some content for a client I have found that some things were not working such as auto node title.

After spending about 30 minutes banging my head to work out what the problem was. If was a problem that I had forgotten about, as I needed to get around this in the past.

Basically the problem is that when you do an update of your system hook_init() is not called. Normally this is not a problem but what happens in that modules like cck use hook_init() to include the token implementation, or even in the case of strongarm all the $conf is updated during hook_init().

So this breaks some important things. The content type that I was updating was creating content for used the auto node title to generate the headers. Which is fine except the fields what were getting put into the title were both cck fields, and since cck's token implementation was not being included, so these tokens for the fields were not being created.

I fixed this with the following line in my code

module_load_include('inc', 'content', 'includes/content.token');

Now I had my cck tokens back, but still it was not working on my test server. This was very disturbing, and after some digging I found the issue.

The problem was based on the fact that I use features transfer the settings to test server and part of this I use strongarm to send the variables for auto node title and path auto. (See http://drupal.org/node/728004 for my patches to allow features and include settings from pathauto and auto node title).

After a little more investigation I found that these settings were being added to the $conf variable during hook_init(), and this was why auto node title didn't think it this node type had not been set up for auto node title.

AAAAArrrrrggggghhhhh!!!!

So addding this code solved my problem.

strongarm_init();

So this was my morning of fun. Need to remember for future reference.

my projects: 

Tags: