0

When running cron manually via GUI the cron starts to run but I have traced down the failure to hook_node_view in one of my modules.

The code is:

if ($node->nid == 47)
{
     //THIS CODE IS HAPPENING, but HOW in hook_node_view when running cron?
     drupal_goto('node/48'); 
}
  • what's in node/47 ? – Jimajamma Dec 12 '11 at 17:41
  • It is a database content type node. There are no other hook crons anywhere. – Chris Muench Dec 12 '11 at 18:34
  • well cron calls search to index your site, and that would open each node to check for what's inside... – Jimajamma Dec 12 '11 at 18:45
  • Is the drupal_goto inside a custom module? If not in what contrib/core module it is (file and line No. please)? If it is in a custom module, like @tostinni said, you should check for the $view_mode == 'full' argument, if not it that drupal_goto will never let your cron finish. – amateur barista Dec 12 '11 at 22:47
2

When you implement hook_node_view(), don't forget to check if you're really displaying the node using this code:

function MYMODULE_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'full' && node_is_page($node)) {
    //Do something...
  }
}

This should correct your errors.

| improve this answer | |
0

I am not positive about Drupal 7, but I think I had a similar problem with Drupal 6.

My recollection is that the node is "viewed" when it is being indexed by the search module.

You can try disabling the search module, and then run cron.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.