I love InsertNode, it gives me exactly the functionality that I need. There is one issue though.

The module breaks cron. I get a fatal error and cron is not working. I have a node that uses php in order to create some dynamic content. This content is inserted in my nodes with InsertNode.

Cron breaks on the php code that is in my dynamic node. I don't see any reason why this code should be called by cron, but it is. Maybe this is due to the search module?

Does anyone know a fix for this?

Comments

AlexisWilke’s picture

Can you view those pages where you have the InsertNode tag when you are not logged in?

The main difference between CRON and you logged in is that CRON runs as anonymous.

Thank you.
Alexis Wilke

cronix’s picture

Yes, you can view the pages when you are not logged on. Everyting was/is working ok. I noticed this bug when I ran cron manually.

Disabling InserNode made cron to work again. Cron also worked when I enabled the module after the first cron run. So I guess cron is indexing the node only once or when its modified?

AlexisWilke’s picture

Hi Cronix,

Did you ever resolve this problem?

Otherwise, would you be able to share the PHP code you use in that node being inserted? That way, maybe I could reproduce the problem on my systems.

Thank you.
Alexis

cronix’s picture

Hi Alexis,

I found a work around. Just use the php function_exists as a wrapper around your code. This will make sure that functions are only defined once during your php session.

if(!function_exists('get_query_string')) {
function get_query_string($vid, $nodetype, $nid, $language, $use_tid)
{
....
}
AlexisWilke’s picture

Status: Fixed » Active

Ah! That explains. Yes, the same code may be executed multiple times. The "only" drawback with that technique is that the function may be created by someone else and not be compatible...

Thank you for sharing your fix!
Alexis Wilke

AlexisWilke’s picture

Status: Active » Fixed

Okay, I wrote an entry in the Known Issues of the documentation in regard to this problem. I'm closing the issue since it is not something that can be fixed in the InsertNode module.

Thank you again for sharing your results!
Alexis Wilke

Status: Active » Closed (fixed)

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